mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-19 00:33:30 +02:00
Fix unchanging rotated canvas size.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user