Add debug code for zoomFactor.

This commit is contained in:
Davide Tantillo 2026-01-28 16:48:37 +01:00
parent 3fa9330c83
commit 5e33132153

View File

@ -233,7 +233,7 @@ class SpineC3PluginInstance extends SDK.IWorldInstanceBase {
if (errorsString) { if (errorsString) {
const webglText = this.getErrorTextC3(iRenderer, this.layoutView); const webglText = this.getErrorTextC3(iRenderer, this.layoutView);
webglText.SetSize(_inst.GetWidth(), _inst.GetHeight(), this.layoutView.GetZoomFactor()); webglText.SetSize(_inst.GetWidth(), _inst.GetHeight(), this.debugZoomFactor(iDrawParams));
webglText.SetText(errorsString); webglText.SetText(errorsString);
const texture = webglText.GetTexture(); const texture = webglText.GetTexture();
@ -247,6 +247,21 @@ class SpineC3PluginInstance extends SDK.IWorldInstanceBase {
} }
} }
private debugZoomFactor (iDrawParams: SDK.Gfx.IDrawParams) {
const layoutView = iDrawParams.GetLayoutView();
let count = 1000;
let zoom = -1;
while (zoom === -1 && count-- > 0) {
try {
zoom = layoutView.GetZoomFactor();
} catch (error) {
console.log("error ZOOM: ", error);
}
}
return zoom === -1 ? 1 : zoom;
}
private setAnimation () { private setAnimation () {
const propValue = this._inst.GetPropertyValue(PLUGIN_CLASS.PROP_ANIMATION) as string; const propValue = this._inst.GetPropertyValue(PLUGIN_CLASS.PROP_ANIMATION) as string;
this.animation = propValue === "" ? undefined : propValue; this.animation = propValue === "" ? undefined : propValue;