mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 14:24: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;
|
let { x, y, width, height } = this.spineBounds;
|
||||||
_inst.SetOrigin(-x / width, -y / height);
|
_inst.SetOrigin(-x / width, -y / height);
|
||||||
|
if (keepScale && oldBoundsWidth !== Infinity && oldBoundsHeight !== Infinity && oldBoundsWidth !== 0 && oldBoundsHeight !== 0) {
|
||||||
if (keepScale) {
|
|
||||||
width *= (_inst.GetWidth() / oldBoundsWidth) * this.propScaleX;
|
width *= (_inst.GetWidth() / oldBoundsWidth) * this.propScaleX;
|
||||||
height *= (_inst.GetHeight() / oldBoundsHeight) * this.propScaleY;
|
height *= (_inst.GetHeight() / oldBoundsHeight) * this.propScaleY;
|
||||||
}
|
}
|
||||||
@ -492,6 +491,10 @@ class SpineC3PluginInstance extends SDK.IWorldInstanceBase {
|
|||||||
this.setBoundsFromBoundsProvider();
|
this.setBoundsFromBoundsProvider();
|
||||||
|
|
||||||
const { x, y, width, height } = this.spineBounds;
|
const { x, y, width, height } = this.spineBounds;
|
||||||
|
if (width === 0 || height === 0) {
|
||||||
|
this.spineBoundsInit = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
this._inst.SetOrigin(-x / width, -y / height);
|
this._inst.SetOrigin(-x / width, -y / height);
|
||||||
|
|
||||||
if (matchesOldBounds) this._inst.SetSize(width, height);
|
if (matchesOldBounds) this._inst.SetSize(width, height);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user