mirror of
https://github.com/photonstorm/phaser
synced 2024-11-16 01:38:23 +00:00
Added origin to resize method
This commit is contained in:
parent
fea262f3e0
commit
45c0c23f6f
1 changed files with 21 additions and 1 deletions
|
@ -234,10 +234,12 @@ var Vertex = new Class({
|
||||||
* @param {number} y - The y position of the vertex.
|
* @param {number} y - The y position of the vertex.
|
||||||
* @param {number} width - The width of the parent Mesh.
|
* @param {number} width - The width of the parent Mesh.
|
||||||
* @param {number} height - The height of the parent Mesh.
|
* @param {number} height - The height of the parent Mesh.
|
||||||
|
* @param {number} originX - The originX of the parent Mesh.
|
||||||
|
* @param {number} originY - The originY of the parent Mesh.
|
||||||
*
|
*
|
||||||
* @return {this} This Vertex.
|
* @return {this} This Vertex.
|
||||||
*/
|
*/
|
||||||
resize: function (x, y, width, height)
|
resize: function (x, y, width, height, originX, originY)
|
||||||
{
|
{
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
|
@ -246,6 +248,24 @@ var Vertex = new Class({
|
||||||
this.vy = -this.y * height;
|
this.vy = -this.y * height;
|
||||||
this.vz = 0;
|
this.vz = 0;
|
||||||
|
|
||||||
|
if (originX < 0.5)
|
||||||
|
{
|
||||||
|
this.vx += width * (0.5 - originX);
|
||||||
|
}
|
||||||
|
else if (originX > 0.5)
|
||||||
|
{
|
||||||
|
this.vx -= width * (originX - 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (originY < 0.5)
|
||||||
|
{
|
||||||
|
this.vy += height * (0.5 - originY);
|
||||||
|
}
|
||||||
|
else if (originY > 0.5)
|
||||||
|
{
|
||||||
|
this.vy -= height * (originY - 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue