mirror of
https://github.com/photonstorm/phaser
synced 2024-11-10 15:14:47 +00:00
Changing scaleX
or scaleY
on a MatterImage
or MatterSprite
would cause the body scale to become distorted as the setters didn't use the correct factor when resetting the initial scale. Fix #4206
This commit is contained in:
parent
bbe95d96d9
commit
cc55ee73cf
2 changed files with 8 additions and 5 deletions
|
@ -230,6 +230,7 @@ one set of bindings ever created, which makes things a lot cleaner.
|
||||||
* `Utils.Array.MoveUp` wouldn't let you move an array element to the top-most index in the array. This also impacted `Container.moveUp`.
|
* `Utils.Array.MoveUp` wouldn't let you move an array element to the top-most index in the array. This also impacted `Container.moveUp`.
|
||||||
* The Texture Tint Pipeline had a logic error that would cause every 2001st quad to either be invisible, or pick-up the texture of the 2000th quad by mistake. The `batchQuad` and `batchTri` methods how handle re-assigning the batch texture if they cause a batch flush as part of their process.
|
* The Texture Tint Pipeline had a logic error that would cause every 2001st quad to either be invisible, or pick-up the texture of the 2000th quad by mistake. The `batchQuad` and `batchTri` methods how handle re-assigning the batch texture if they cause a batch flush as part of their process.
|
||||||
* Rotating Sprites that used a Normal Map wouldn't rotate the normal map with it, causing the lighting effects to become irregular. The normal map vectors are now rotated correctly (thanks @sercant for the PR and @fazzamatazz and @ysraelJMM for the report)
|
* Rotating Sprites that used a Normal Map wouldn't rotate the normal map with it, causing the lighting effects to become irregular. The normal map vectors are now rotated correctly (thanks @sercant for the PR and @fazzamatazz and @ysraelJMM for the report)
|
||||||
|
* Changing `scaleX` or `scaleY` on a `MatterImage` or `MatterSprite` would cause the body scale to become distorted as the setters didn't use the correct factor when resetting the initial scale. Fix #4206 (thanks @YannCaron)
|
||||||
|
|
||||||
### Examples and TypeScript
|
### Examples and TypeScript
|
||||||
|
|
||||||
|
|
|
@ -84,8 +84,9 @@ var Transform = {
|
||||||
|
|
||||||
set: function (value)
|
set: function (value)
|
||||||
{
|
{
|
||||||
var factor = 1 / this._scaleX;
|
var factorX = 1 / this._scaleX;
|
||||||
|
var factorY = 1 / this._scaleY;
|
||||||
|
|
||||||
this._scaleX = value;
|
this._scaleX = value;
|
||||||
|
|
||||||
if (this._scaleX === 0)
|
if (this._scaleX === 0)
|
||||||
|
@ -98,7 +99,7 @@ var Transform = {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset Matter scale back to 1 (sigh)
|
// Reset Matter scale back to 1 (sigh)
|
||||||
Body.scale(this.body, factor, this._scaleY);
|
Body.scale(this.body, factorX, factorY);
|
||||||
|
|
||||||
Body.scale(this.body, value, this._scaleY);
|
Body.scale(this.body, value, this._scaleY);
|
||||||
}
|
}
|
||||||
|
@ -121,7 +122,8 @@ var Transform = {
|
||||||
|
|
||||||
set: function (value)
|
set: function (value)
|
||||||
{
|
{
|
||||||
var factor = 1 / this._scaleY;
|
var factorX = 1 / this._scaleX;
|
||||||
|
var factorY = 1 / this._scaleY;
|
||||||
|
|
||||||
this._scaleY = value;
|
this._scaleY = value;
|
||||||
|
|
||||||
|
@ -134,7 +136,7 @@ var Transform = {
|
||||||
this.renderFlags |= _FLAG;
|
this.renderFlags |= _FLAG;
|
||||||
}
|
}
|
||||||
|
|
||||||
Body.scale(this.body, this._scaleX, factor);
|
Body.scale(this.body, factorX, factorY);
|
||||||
|
|
||||||
Body.scale(this.body, this._scaleX, value);
|
Body.scale(this.body, this._scaleX, value);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue