mirror of
https://github.com/photonstorm/phaser
synced 2025-02-16 22:18:29 +00:00
Fixing DomElement position when camera zoom != 1
When the camera zoom is set to any other value than one, if a dom element origin if set to anything other than 0, the final position of the DOM was incorrect. I traced this back to the DOMElementCSSRenderer. After some trial and error, I realized the translation needed to be applied after camera multiplication and not at the beginning. With this change, DOMElements are correctly positioned.
This commit is contained in:
parent
1ba01834ff
commit
0bcc71d469
1 changed files with 4 additions and 1 deletions
|
@ -85,7 +85,7 @@ var DOMElementCSSRenderer = function (renderer, src, camera, parentMatrix)
|
|||
dx = (src.width) * src.originX;
|
||||
dy = (src.height) * src.originY;
|
||||
|
||||
srcMatrix.applyITRS(src.x - dx, src.y - dy, src.rotation, src.scaleX, src.scaleY);
|
||||
srcMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY);
|
||||
|
||||
camMatrix.copyFrom(camera.matrix);
|
||||
|
||||
|
@ -97,6 +97,9 @@ var DOMElementCSSRenderer = function (renderer, src, camera, parentMatrix)
|
|||
|
||||
// Multiply by the src matrix, store result in calcMatrix
|
||||
camMatrix.multiply(srcMatrix, calcMatrix);
|
||||
|
||||
calcMatrix.e -= dx;
|
||||
calcMatrix.f -= dy;
|
||||
}
|
||||
|
||||
if (!src.transformOnly)
|
||||
|
|
Loading…
Add table
Reference in a new issue