mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-28 03:39:13 +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 rotation = 0
|
||||||
var loading = false
|
var loading = false
|
||||||
var scaler
|
var scaler
|
||||||
|
var projectedSize
|
||||||
var seq = 0
|
var seq = 0
|
||||||
var cssTransform = VendorUtil.style(['transform', 'webkitTransform'])
|
var cssTransform = VendorUtil.style(['transform', 'webkitTransform'])
|
||||||
|
|
||||||
@@ -210,10 +211,13 @@ module.exports = function DeviceScreenDirective($document, ScalingService,
|
|||||||
|
|
||||||
function maybeLoadScreen() {
|
function maybeLoadScreen() {
|
||||||
if (!loading && scope.$parent.showScreen && scope.device) {
|
if (!loading && scope.$parent.showScreen && scope.device) {
|
||||||
|
projectedSize = scaler.projectedSize(
|
||||||
|
boundingWidth, boundingHeight, rotation
|
||||||
|
)
|
||||||
loading = true
|
loading = true
|
||||||
imageRender.load(scope.device.display.url +
|
imageRender.load(scope.device.display.url +
|
||||||
'?width=' + Math.ceil(boundingWidth * guestDisplayDensity) +
|
'?width=' + Math.ceil(projectedSize.width * guestDisplayDensity) +
|
||||||
'&height=' + Math.ceil(boundingHeight * guestDisplayDensity) +
|
'&height=' + Math.ceil(projectedSize.height * guestDisplayDensity) +
|
||||||
'&time=' + Date.now()
|
'&time=' + Date.now()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -247,12 +251,8 @@ module.exports = function DeviceScreenDirective($document, ScalingService,
|
|||||||
imageRender.canvasWidth = cachedImageWidth
|
imageRender.canvasWidth = cachedImageWidth
|
||||||
imageRender.canvasHeight = cachedImageHeight
|
imageRender.canvasHeight = cachedImageHeight
|
||||||
|
|
||||||
var size = scaler.projectedSize(
|
imageRender.canvasStyleWidth = projectedSize.width
|
||||||
boundingWidth, boundingHeight, rotation
|
imageRender.canvasStyleHeight = projectedSize.height
|
||||||
)
|
|
||||||
|
|
||||||
imageRender.canvasStyleWidth = size.width
|
|
||||||
imageRender.canvasStyleHeight = size.height
|
|
||||||
|
|
||||||
// @todo Make sure that each position is able to rotate smoothly
|
// @todo Make sure that each position is able to rotate smoothly
|
||||||
// to the next one. This current setup doesn't work if rotation
|
// to the next one. This current setup doesn't work if rotation
|
||||||
|
|||||||
Reference in New Issue
Block a user