Merge pull request #5213 from samme/fix/matter-setCrop

Fix setCrop() for Matter.Image and Matter.Sprite
This commit is contained in:
Richard Davey 2020-07-13 13:14:59 +01:00 committed by GitHub
commit 7fae62cbc8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 0 deletions

View file

@ -86,6 +86,16 @@ var MatterImage = new Class({
{ {
GameObject.call(this, world.scene, 'Image'); GameObject.call(this, world.scene, 'Image');
/**
* The internal crop data object, as used by `setCrop` and passed to the `Frame.setCropUVs` method.
*
* @name Phaser.Physics.Matter.Image#_crop
* @type {object}
* @private
* @since 3.24.0
*/
this._crop = this.resetCropObject();
this.setTexture(texture, frame); this.setTexture(texture, frame);
this.setSizeToFrame(); this.setSizeToFrame();
this.setOrigin(); this.setOrigin();

View file

@ -90,6 +90,16 @@ var MatterSprite = new Class({
{ {
GameObject.call(this, world.scene, 'Sprite'); GameObject.call(this, world.scene, 'Sprite');
/**
* The internal crop data object, as used by `setCrop` and passed to the `Frame.setCropUVs` method.
*
* @name Phaser.Physics.Matter.Sprite#_crop
* @type {object}
* @private
* @since 3.24.0
*/
this._crop = this.resetCropObject();
this.anims = new AnimationComponent(this); this.anims = new AnimationComponent(this);
this.setTexture(texture, frame); this.setTexture(texture, frame);