fix(showcase): fixed an issue where scaling isn't working

This commit is contained in:
Haoyu Xu
2024-08-02 15:08:12 +08:00
parent 5c9bb29b9d
commit f62a0582fc
2 changed files with 7 additions and 2 deletions

View File

@@ -509,7 +509,7 @@ export default class Settings {
</div>
<div>
<label for="scale">Scale</label>
<input type="range" min="0" max="10" step="0.1" id="scale_slider" value="${this.#scale}" />
<input type="range" min="0.1" max="10" step="0.1" id="scale_slider" value="${this.#scale}" />
<input type="number" id="scale_input" name="scale" value="${this.#scale}" step="0.1"/>
</div>
<div>

View File

@@ -11069,6 +11069,11 @@ var spine;
config.settingsScale = window.settings.scale;
return config;
};
SpinePlayer.prototype.getOperatorScale = function () {
if (typeof window.settings !== "undefined")
return window.settings.scale;
return this.config.settingsScale
};
SpinePlayer.prototype.showError = function (error) {
var errorDom = findWithClass(this.dom, "spine-player-error")[0];
errorDom.classList.remove("spine-player-hidden");
@@ -11395,7 +11400,7 @@ var spine;
var viewportSize = this.scale(viewport.width, viewport.height, this.canvas.width, this.canvas.height);
// this.sceneRenderer.camera.zoom = viewport.width * devicePixelRatio / viewportSize.x;
this.sceneRenderer.camera.zoom = viewport.width * devicePixelRatio / viewportSize.x * this.config.settingsScale;
this.sceneRenderer.camera.zoom = viewport.width * devicePixelRatio / viewportSize.x * this.getOperatorScale();
this.sceneRenderer.camera.position.x = viewport.x + viewport.width / 2;
this.sceneRenderer.camera.position.y = viewport.y + viewport.height / 2;
this.sceneRenderer.begin();