From a18aa84429258413b0e7adcd6c211f243ebefcf2 Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Fri, 21 Dec 2018 10:24:05 -0500 Subject: #766 - wait for rotation to complete or width/height will be wrong --- www/js/EventCtrl.js | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) (limited to 'www/js/EventCtrl.js') diff --git a/www/js/EventCtrl.js b/www/js/EventCtrl.js index b3741489..70883b29 100644 --- a/www/js/EventCtrl.js +++ b/www/js/EventCtrl.js @@ -2823,23 +2823,27 @@ 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); - - 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); - + // remember, devHeight/devWidth upate 300ms after rotation + $timeout ( function () { + 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); + + 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); + + } + + } - - - } + },500); + } -- cgit v1.2.3