Fix setting invalid bounds.

This commit is contained in:
Davide Tantillo 2026-02-02 10:07:18 +01:00
parent 18ce3ae156
commit 6b1209d34a

View File

@ -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);