diff options
| author | Pliable Pixels <pliablepixels@gmail.com> | 2020-09-05 17:16:27 -0400 |
|---|---|---|
| committer | Pliable Pixels <pliablepixels@gmail.com> | 2020-09-05 17:16:27 -0400 |
| commit | f3b29a2457c069230d6b7ecc17df715ece42c5a0 (patch) | |
| tree | 61d869aae1535c86e780e23107a921dbe9ed9c9b /www/js | |
| parent | 0426e20bf1e75e93872351decd82ad653431ec82 (diff) | |
#963 move to flex box wrap
Diffstat (limited to 'www/js')
| -rw-r--r-- | www/js/EventCtrl.js | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/www/js/EventCtrl.js b/www/js/EventCtrl.js index a83f6b1e..0cc99651 100644 --- a/www/js/EventCtrl.js +++ b/www/js/EventCtrl.js @@ -2961,16 +2961,36 @@ angular.module('zmApp.controllers') } + function calculateAspectRatioFit(srcWidth, srcHeight, maxWidth, maxHeight) { + // credit: https://stackoverflow.com/a/14731922 + var ratio = Math.min(maxWidth / srcWidth, maxHeight / srcHeight); + return { w: Math.round(srcWidth*ratio), h: Math.round(srcHeight*ratio) }; + } + + function computeThumbnailSize(mw, mh, mo) { - + if (mo != 0 && mo != 180) { + + var tmp = mw; + mw = mh; + mh = tmp; + } var ld = NVR.getLogin(); + if (ld.eventViewThumbsSize == 'large') { + return calculateAspectRatioFit(mw, mh, 0.9* $rootScope.devWidth, 0.4 * $rootScope.devHeight); + + } else { + return calculateAspectRatioFit(mw, mh, 0.3 * $rootScope.devWidth, 0.3 * $rootScope.devHeight); + } + + /* if (ld.eventViewThumbsSize == 'large') { tw = Math.round(0.9 * $rootScope.devWidth); th = Math.round(0.7 * $rootScope.devHeight); } else { tw = Math.round(0.4 * $rootScope.devWidth); - th = Math.round(0.3 * $rootScope.devHeight); + th = Math.round(0.3 * $rootScope.devHeight); } @@ -2982,7 +3002,7 @@ angular.module('zmApp.controllers') h: 0 }; - + */ /* seems I really should be using strings due to horz and very but luckily parseInt will make them 0 which gets treated as "nothing to do" '0' => translate('Normal'), @@ -2993,6 +3013,7 @@ angular.module('zmApp.controllers') 'vert' => translate('FlippedVert') */ + /* if (mo != 0 && mo != 180) { var tmp = mw; @@ -3020,7 +3041,7 @@ angular.module('zmApp.controllers') result.w = mw; result.h = mh; return result; - +*/ } |
