From 1896d81bcfeec5bf3b3baee16e6f2134f4071a4b Mon Sep 17 00:00:00 2001 From: Simo Kinnunen Date: Thu, 11 Sep 2014 21:28:33 +0900 Subject: [PATCH] Fix unchanging rotated canvas size. --- .../components/stf/screen/screen-directive.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/res/app/components/stf/screen/screen-directive.js b/res/app/components/stf/screen/screen-directive.js index 5dafc79d..f5c3d67e 100644 --- a/res/app/components/stf/screen/screen-directive.js +++ b/res/app/components/stf/screen/screen-directive.js @@ -26,6 +26,7 @@ module.exports = function DeviceScreenDirective($document, ScalingService, var rotation = 0 var loading = false var scaler + var projectedSize var seq = 0 var cssTransform = VendorUtil.style(['transform', 'webkitTransform']) @@ -210,10 +211,13 @@ module.exports = function DeviceScreenDirective($document, ScalingService, function maybeLoadScreen() { if (!loading && scope.$parent.showScreen && scope.device) { + projectedSize = scaler.projectedSize( + boundingWidth, boundingHeight, rotation + ) loading = true imageRender.load(scope.device.display.url + - '?width=' + Math.ceil(boundingWidth * guestDisplayDensity) + - '&height=' + Math.ceil(boundingHeight * guestDisplayDensity) + + '?width=' + Math.ceil(projectedSize.width * guestDisplayDensity) + + '&height=' + Math.ceil(projectedSize.height * guestDisplayDensity) + '&time=' + Date.now() ) } @@ -247,12 +251,8 @@ module.exports = function DeviceScreenDirective($document, ScalingService, imageRender.canvasWidth = cachedImageWidth imageRender.canvasHeight = cachedImageHeight - var size = scaler.projectedSize( - boundingWidth, boundingHeight, rotation - ) - - imageRender.canvasStyleWidth = size.width - imageRender.canvasStyleHeight = size.height + imageRender.canvasStyleWidth = projectedSize.width + imageRender.canvasStyleHeight = projectedSize.height // @todo Make sure that each position is able to rotate smoothly // to the next one. This current setup doesn't work if rotation