mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 06:14:53 +08:00
Fix setting invalid bounds.
This commit is contained in:
parent
18ce3ae156
commit
6b1209d34a
@ -467,8 +467,7 @@ class SpineC3PluginInstance extends SDK.IWorldInstanceBase {
|
||||
|
||||
let { x, y, width, height } = this.spineBounds;
|
||||
_inst.SetOrigin(-x / width, -y / height);
|
||||
|
||||
if (keepScale) {
|
||||
if (keepScale && oldBoundsWidth !== Infinity && oldBoundsHeight !== Infinity && oldBoundsWidth !== 0 && oldBoundsHeight !== 0) {
|
||||
width *= (_inst.GetWidth() / oldBoundsWidth) * this.propScaleX;
|
||||
height *= (_inst.GetHeight() / oldBoundsHeight) * this.propScaleY;
|
||||
}
|
||||
@ -492,6 +491,10 @@ class SpineC3PluginInstance extends SDK.IWorldInstanceBase {
|
||||
this.setBoundsFromBoundsProvider();
|
||||
|
||||
const { x, y, width, height } = this.spineBounds;
|
||||
if (width === 0 || height === 0) {
|
||||
this.spineBoundsInit = true;
|
||||
return;
|
||||
}
|
||||
this._inst.SetOrigin(-x / width, -y / height);
|
||||
|
||||
if (matchesOldBounds) this._inst.SetSize(width, height);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user