From f3b29a2457c069230d6b7ecc17df715ece42c5a0 Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Sat, 5 Sep 2020 17:16:27 -0400 Subject: #963 move to flex box wrap --- www/css/style.css | 6 ++++++ www/js/EventCtrl.js | 29 +++++++++++++++++++++++++---- www/templates/events.html | 6 +++--- 3 files changed, 34 insertions(+), 7 deletions(-) (limited to 'www') diff --git a/www/css/style.css b/www/css/style.css index a0a19319..707c4603 100644 --- a/www/css/style.css +++ b/www/css/style.css @@ -1917,8 +1917,14 @@ fill-opacity: 0.8; } .smallThumbs { + + flex-wrap:wrap; float:right; + + + + } .no-padding { padding: 0px !important; 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; - +*/ } diff --git a/www/templates/events.html b/www/templates/events.html index e7f4f48d..1a964f6c 100644 --- a/www/templates/events.html +++ b/www/templates/events.html @@ -50,7 +50,7 @@   {{prettifyDate(event.Event.StartTime)}}  {{tzAbbr}}  -
@@ -60,7 +60,7 @@ -
+
@@ -98,7 +98,7 @@
-
+