diff options
| author | pliablepixels <pliablepixels@gmail.com> | 2016-04-25 11:19:09 -0400 |
|---|---|---|
| committer | pliablepixels <pliablepixels@gmail.com> | 2016-04-25 11:19:09 -0400 |
| commit | d77857a5789dc907ab8c7c578a2a24e8155add52 (patch) | |
| tree | b0e9185127f710a2e10cc1906997f6e2fa333189 /www/js/MonitorModalCtrl.js | |
| parent | e7f2da043d19c1adb5d389c383dc8b1779ed0227 (diff) | |
#232 undid client side hacks - this needs to be fixed at ZMS, follow the discussion here https://github.com/ZoneMinder/ZoneMinder/issues/1431
Former-commit-id: a5b57378d2fca9bcbc3966ed182a81ccebc84983
Diffstat (limited to 'www/js/MonitorModalCtrl.js')
| -rw-r--r-- | www/js/MonitorModalCtrl.js | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/www/js/MonitorModalCtrl.js b/www/js/MonitorModalCtrl.js index 789fd6f7..9ae2f324 100644 --- a/www/js/MonitorModalCtrl.js +++ b/www/js/MonitorModalCtrl.js @@ -1778,10 +1778,43 @@ angular.module('zmApp.controllers').controller('MonitorModalCtrl', ['$scope', '$ } - + //http://stackoverflow.com/questions/10245220/java-image-resize-maintain-aspect-ratio + $scope.getScale = function(ow,oh,bw,bh) + { + + var original_width = ow; + var original_height = oh; + var bound_width = bw; + var bound_height = bh; + var new_width = original_width; + var new_height = original_height; + if (original_width > bound_width) { + //scale width to fit + new_width = bound_width; + //scale height to maintain aspect ratio + new_height = (new_width * original_height) / original_width; + } + + // then check if we need to scale even with the new height + if (new_height > bound_height) { + //scale height to fit instead + new_height = bound_height; + //scale width to maintain aspect ratio + new_width = (new_height * original_width) / original_height; + } + return ({w:new_width, h:new_height}); + + }; + $scope.$on('modal.shown', function () { + $scope.mw = $scope.refMonitor.Monitor.Orientation == '0' ? $scope.refMonitor.Monitor.Width: $scope.refMonitor.Monitor.Height; + + $scope.mh = $scope.refMonitor.Monitor.Orientation == '0' ? $scope.refMonitor.Monitor.Height: $scope.refMonitor.Monitor.Width; + + + var ld = ZMDataModel.getLogin(); currentEvent = $scope.currentEvent; $scope.connKey = (Math.floor((Math.random() * 999999) + 1)).toString(); |
