summaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
authorPliable Pixels <pliablepixels@gmail.com>2020-09-08 07:18:20 -0400
committerPliable Pixels <pliablepixels@gmail.com>2020-09-08 07:18:20 -0400
commit7879974cb3dd9e8893cb43475df3041d33047ba5 (patch)
tree3fd2561862818244bed9b247043fb4aa32472c75 /www
parent263814ad6fff42161285fe907d3459a430a38efd (diff)
fix device size calculation on start
Diffstat (limited to 'www')
-rwxr-xr-xwww/js/app.js36
1 files changed, 24 insertions, 12 deletions
diff --git a/www/js/app.js b/www/js/app.js
index 8b4b3e88..60b1fd30 100755
--- a/www/js/app.js
+++ b/www/js/app.js
@@ -1151,6 +1151,14 @@ angular.module('zmApp', [
$rootScope.platformOS = "desktop";
NVR.log("Device is ready");
+ NVR.log ("setting size");
+ $timeout (function () {
+
+ computeDeviceSize();
+
+ },30);
+
+
//console.log ("*************** PLATFORM IS: "+ionic.Platform.platform());
var ua = navigator.userAgent.toLowerCase();
NVR.debug ("UA is "+ua);
@@ -1414,6 +1422,21 @@ 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 () {
if ($rootScope.online == true) {
@@ -1475,18 +1498,7 @@ angular.module('zmApp', [
// give rotation time to actually rotate, or width/height will be bogus
$timeout ( function() {
- 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)");
-
+ computeDeviceSize();
$rootScope.$broadcast('sizechanged');
},300);