engine icon indicating copy to clipboard operation
engine copied to clipboard

Fix: Optimize the update logic of the default size of the `Sprite`

Open cptbtptpbcptdtptp opened this issue 2 years ago • 0 comments

When replacing textures or modifying regions, the sprite size should be updated.

Before:

sprite.texture = oldTexture;
// sprite.region = oldRegion;
console.log('old width',  sprite.width);
sprite.texture = newTexture;
// sprite.region = newRegion;
console.log('new width',  sprite.width);

The results obtained are equal.

But we think that at this moment the developer wants to update the width and height of the sprite.

cptbtptpbcptdtptp avatar Sep 22 '22 15:09 cptbtptpbcptdtptp