engine
engine copied to clipboard
Fix: Optimize the update logic of the default size of the `Sprite`
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.