mirror of
https://github.com/photonstorm/phaser
synced 2024-11-24 05:33:35 +00:00
Calling Rectangle.setSize()
wouldn't change the underlying geometry of the Shape Game Object, causing any stroke to be incorrectly rendered after a size change.
This commit is contained in:
parent
edf074ba47
commit
111a4e1ce2
1 changed files with 33 additions and 2 deletions
|
@ -65,6 +65,37 @@ var Rectangle = new Class({
|
||||||
this.updateData();
|
this.updateData();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the internal size of this Game Object, as used for frame or physics body creation.
|
||||||
|
*
|
||||||
|
* This will not change the size that the Game Object is rendered in-game.
|
||||||
|
* For that you need to either set the scale of the Game Object (`setScale`) or call the
|
||||||
|
* `setDisplaySize` method, which is the same thing as changing the scale but allows you
|
||||||
|
* to do so by giving pixel values.
|
||||||
|
*
|
||||||
|
* If you have enabled this Game Object for input, changing the size will _not_ change the
|
||||||
|
* size of the hit area. To do this you should adjust the `input.hitArea` object directly.
|
||||||
|
*
|
||||||
|
* @method Phaser.GameObjects.Rectangle#setSize
|
||||||
|
* @since 3.13.0
|
||||||
|
*
|
||||||
|
* @param {number} width - The width of this Game Object.
|
||||||
|
* @param {number} height - The height of this Game Object.
|
||||||
|
*
|
||||||
|
* @return {this} This Game Object instance.
|
||||||
|
*/
|
||||||
|
setSize: function (width, height)
|
||||||
|
{
|
||||||
|
this.width = width;
|
||||||
|
this.height = height;
|
||||||
|
|
||||||
|
this.geom.setSize(width, height);
|
||||||
|
|
||||||
|
this.updateData();
|
||||||
|
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal method that updates the data and path values.
|
* Internal method that updates the data and path values.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue