summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--www/js/EventCtrl.js44
-rw-r--r--www/templates/events.html13
2 files changed, 43 insertions, 14 deletions
diff --git a/www/js/EventCtrl.js b/www/js/EventCtrl.js
index 26c6ffcc..b0377d5d 100644
--- a/www/js/EventCtrl.js
+++ b/www/js/EventCtrl.js
@@ -87,6 +87,7 @@ angular.module('zmApp.controllers')
// console.log ("********* AFTER ENTER");
//
+ window.addEventListener("resize", recomputeThumbSize, false);
$ionicListDelegate.canSwipeItems(true);
NVRDataModel.debug("enabling options swipe");
@@ -142,6 +143,8 @@ angular.module('zmApp.controllers')
$scope.$on('$ionicView.beforeLeave', function () {
+ NVRDataModel.debug("EventCtrl: Deregistering resize listener");
+ window.removeEventListener("resize", recomputeThumbSize, false);
NVRDataModel.debug("EventCtrl: Deregistering broadcast handles");
for (var i = 0; i < broadcastHandles.length; i++) {
// broadcastHandles[i]();
@@ -2782,8 +2785,37 @@ angular.module('zmApp.controllers')
};
+
+ function recomputeThumbSize() {
+ NVRDataModel.debug ("EventCtrl: recompute thumbnails");
+
+ for (var i=0; i < $scope.events.length; i++) {
+ var tempMon = NVRDataModel.getMonitorObject($scope.events[i].Event.MonitorId);
+ if (tempMon != undefined) {
+
+ var mw = parseInt(tempMon.Monitor.Width);
+ var mh = parseInt(tempMon.Monitor.Height);
+ var mo = parseInt(tempMon.Monitor.Orientation);
+
+ // in recompute, we've already taken care of orientation
+ // so don't pass it again
+ var th = computeThumbnailSize(mw, mh, mo);
+ $scope.events[i].Event.thumbWidth = th.w;
+ $scope.events[i].Event.thumbHeight = th.h;
+ console.log ("Setting to "+th.w+"*"+th.h);
+
+ }
+
+
+ }
+
+ }
function computeThumbnailSize(mw, mh, mo) {
+
+
+ tw = Math.min(Math.round(0.35 * $rootScope.devWidth),200);
+ th = 150;
var ratio = mw / mh;
var result = {
@@ -2800,15 +2832,15 @@ angular.module('zmApp.controllers')
if (mw > mh) {
ratio = mh / mw;
- mw = zm.thumbWidth;
- mh = zm.thumbWidth * ratio;
+ mw = tw;
+ mh = tw * ratio;
} else if (mh > mw) {
ratio = mw / mh;
- mh = zm.thumbWidth;
- mw = zm.thumbWidth * ratio;
+ mh = th;
+ mw = th * ratio;
} else {
- mw = zm.thumbWidth;
- mw = zm.thumbWidth;
+ mw = tw;
+ mw = tw;
}
mw = Math.round(mw);
mh = Math.round(mh);
diff --git a/www/templates/events.html b/www/templates/events.html
index 23b5c728..c517966f 100644
--- a/www/templates/events.html
+++ b/www/templates/events.html
@@ -93,15 +93,12 @@
</div>
- <div class="col col-40" align="right" ng-if="loginData.enableThumbs">
- <!-- thumbnail -->
-
- <!-- ng-image-appear transition-duration="0.5s" animation="fillIn" bg-color="#50a4e2" {{event.Event.thumbWidth}}X{{event.Event.thumbHeight}}-->
- <div >
- <img ng-image-appear no-loader transition-duration="0.3s" animation="fillIn" bg-color="#6C7A89" ng-src="{{constructThumbnail(event)}}"
- on-tap="closeIfOpen(event);openModalWithSnapshot(event)" width="{{event.Event.thumbWidth}}" height="{{event.Event.thumbHeight}}" />
+ <div align="right" class="col col-40" ng-if="loginData.enableThumbs" >
+
+ <img ng-image-appear no-loader transition-duration="0.3s" animation="fillIn" bg-color="#6C7A89" ng-src="{{constructThumbnail(event)}}"
+ on-tap="closeIfOpen(event);openModalWithSnapshot(event)" width="{{event.Event.thumbWidth}}px" height="{{event.Event.thumbHeight}}px" />
<!--<p>{{event.Event.thumbWidth}}px*{{event.Event.thumbHeight}}px</p>-->
- </div>
+
</div>