summaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
authorPliable Pixels <pliablepixels@gmail.com>2020-09-08 19:45:16 -0400
committerPliable Pixels <pliablepixels@gmail.com>2020-09-08 19:45:16 -0400
commitbeb9f4ca67b7de10f6985979ea4d63fe306cb6dc (patch)
treebaa425aecf024ba9b4d964e09707048e617d7dff /www
parent7dfe1929c106caf71b00caa81fd4dcd8c92887a9 (diff)
#970 recompute device w/h on entry into events - needed only when you start in events view on app start. earlier dimensions are not accurate, leading to whitespace till you rotate
Diffstat (limited to 'www')
-rw-r--r--www/js/EventCtrl.js6
-rw-r--r--www/js/NVR.js18
-rwxr-xr-xwww/js/app.js19
3 files changed, 27 insertions, 16 deletions
diff --git a/www/js/EventCtrl.js b/www/js/EventCtrl.js
index 2a75cccc..23fda099 100644
--- a/www/js/EventCtrl.js
+++ b/www/js/EventCtrl.js
@@ -209,6 +209,12 @@ angular.module('zmApp.controllers')
broadcastHandles = [];
});
+ $scope.$on('$ionicView.afterEnter', function () {
+ // don't know why but on app start, dimensions are wrong
+ NVR.computeDeviceSize();
+ });
+
+
$scope.$on('$ionicView.beforeEnter', function () {
/*
diff --git a/www/js/NVR.js b/www/js/NVR.js
index 99116eb4..93897623 100644
--- a/www/js/NVR.js
+++ b/www/js/NVR.js
@@ -326,6 +326,21 @@ angular.module('zmApp.controllers')
return p? loginData.unsupported[p]:loginData.unsupported;
}
+ function computeDeviceSize() {
+ var pixelRatio = window.devicePixelRatio || 1;
+ $rootScope.pixelRatio = pixelRatio;
+ $rootScope.devWidth = ((window.innerWidth > 0) ? window.innerWidth : screen.width);
+ $rootScope.devHeight = ((window.innerHeight > 0) ? window.innerHeight : screen.height);
+ $rootScope.videoHeight = $rootScope.devHeight - 20;
+ $rootScope.devWidthIgnorePix = $rootScope.devWidth;
+
+ $rootScope.devWidth *= pixelRatio;
+ $rootScope.devHeight *= pixelRatio;
+
+ debug("resize/orient: " + $rootScope.devWidth + "(w) * " + $rootScope.devHeight+"(h)");
+
+ }
+
function getBandwidth() {
// if mode is not on always return high
if (loginData.enableLowBandwidth == false) {
@@ -2867,6 +2882,9 @@ angular.module('zmApp.controllers')
getSnapshotFrame: function () {
return snapshotFrame;
},
+ computeDeviceSize: function () {
+ return computeDeviceSize();
+ },
//-----------------------------------------------------------------------------
// This function returns a list of monitors
diff --git a/www/js/app.js b/www/js/app.js
index c35d52aa..a21d2da1 100755
--- a/www/js/app.js
+++ b/www/js/app.js
@@ -1153,7 +1153,7 @@ angular.module('zmApp', [
NVR.log ("setting size");
$timeout (function () {
- computeDeviceSize();
+ NVR.computeDeviceSize();
},30);
@@ -1421,20 +1421,7 @@ angular.module('zmApp', [
});
}
- function computeDeviceSize() {
- var pixelRatio = window.devicePixelRatio || 1;
- $rootScope.pixelRatio = pixelRatio;
- $rootScope.devWidth = ((window.innerWidth > 0) ? window.innerWidth : screen.width);
- $rootScope.devHeight = ((window.innerHeight > 0) ? window.innerHeight : screen.height);
- $rootScope.videoHeight = $rootScope.devHeight - 20;
- $rootScope.devWidthIgnorePix = $rootScope.devWidth;
-
- $rootScope.devWidth *= pixelRatio;
- $rootScope.devHeight *= pixelRatio;
-
- NVR.debug("resize/orient: " + $rootScope.devWidth + "(w) * " + $rootScope.devHeight+"(h)");
-
- }
+
function onOnline() {
$timeout(function () {
@@ -1497,7 +1484,7 @@ angular.module('zmApp', [
// give rotation time to actually rotate, or width/height will be bogus
$timeout ( function() {
- computeDeviceSize();
+ NVR.computeDeviceSize();
$rootScope.$broadcast('sizechanged');
},300);