diff options
Diffstat (limited to 'www/js/app.js')
| -rwxr-xr-x | www/js/app.js | 36 |
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); |
