Update other names.

This commit is contained in:
Davide Tantillo 2025-04-30 17:09:50 +02:00
parent 035a08e1a9
commit a6887006be

View File

@ -1949,7 +1949,7 @@ class SpineWebComponentOverlay extends HTMLElement implements OverlayAttributes,
renderer.end(); renderer.end();
} }
const updateFollowSlotsPosition = () => { const updateBoneFollowers = () => {
for (const { skeleton, onScreen, boneFollowerList, worldX, worldY } of this.widgets) { for (const { skeleton, onScreen, boneFollowerList, worldX, worldY } of this.widgets) {
if (skeleton && onScreen) { if (skeleton && onScreen) {
for (const { slot, bone, element, followAttachmentAttach, followRotation, followOpacity, followScale } of boneFollowerList) { for (const { slot, bone, element, followAttachmentAttach, followRotation, followOpacity, followScale } of boneFollowerList) {
@ -1995,7 +1995,7 @@ class SpineWebComponentOverlay extends HTMLElement implements OverlayAttributes,
this.translateCanvas(); this.translateCanvas();
updateWidgets(); updateWidgets();
renderWidgets(); renderWidgets();
updateFollowSlotsPosition(); updateBoneFollowers();
} }
requestAnimationFrame(loop); requestAnimationFrame(loop);
@ -2054,8 +2054,8 @@ class SpineWebComponentOverlay extends HTMLElement implements OverlayAttributes,
return inputPointTemp; return inputPointTemp;
} }
let prevX = 0; let lastX = 0;
let prevY = 0; let lastY = 0;
inputManager.addListener({ inputManager.addListener({
// moved is used to pass cursor position wrt to canvas and widget position and currently is EXPERIMENTAL // moved is used to pass cursor position wrt to canvas and widget position and currently is EXPERIMENTAL
moved: (x, y, ev) => { moved: (x, y, ev) => {
@ -2087,14 +2087,14 @@ class SpineWebComponentOverlay extends HTMLElement implements OverlayAttributes,
} }
} }
prevX = input.x; lastX = input.x;
prevY = input.y; lastY = input.y;
}, },
dragged: (x, y, ev) => { dragged: (x, y, ev) => {
const input = getInput(ev); const input = getInput(ev);
let dragX = input.x - prevX; let dragX = input.x - lastX;
let dragY = input.y - prevY; let dragY = input.y - lastY;
this.updateCursor(input); this.updateCursor(input);
@ -2112,8 +2112,8 @@ class SpineWebComponentOverlay extends HTMLElement implements OverlayAttributes,
ev?.preventDefault(); ev?.preventDefault();
ev?.stopPropagation(); ev?.stopPropagation();
} }
prevX = input.x; lastX = input.x;
prevY = input.y; lastY = input.y;
}, },
up: (x, y, ev) => { up: (x, y, ev) => {
for (const widget of this.widgets) { for (const widget of this.widgets) {
@ -2221,7 +2221,7 @@ class SpineWebComponentOverlay extends HTMLElement implements OverlayAttributes,
this.lastViewportWidth = this.lastViewportWidth === 0 ? width : width * SpineWebComponentOverlay.WIDTH_INCREMENT; this.lastViewportWidth = this.lastViewportWidth === 0 ? width : width * SpineWebComponentOverlay.WIDTH_INCREMENT;
this.lastViewportHeight = height * SpineWebComponentOverlay.HEIGHT_INCREMENT; this.lastViewportHeight = height * SpineWebComponentOverlay.HEIGHT_INCREMENT;
this.scaleSkeletonDPR(); this.updateWidgetScales();
} else { } else {
if (width > this.lastViewportWidth) this.lastViewportWidth = width * SpineWebComponentOverlay.WIDTH_INCREMENT; if (width > this.lastViewportWidth) this.lastViewportWidth = width * SpineWebComponentOverlay.WIDTH_INCREMENT;
if (height > this.lastViewportHeight) this.lastViewportHeight = height * SpineWebComponentOverlay.HEIGHT_INCREMENT; if (height > this.lastViewportHeight) this.lastViewportHeight = height * SpineWebComponentOverlay.HEIGHT_INCREMENT;
@ -2248,7 +2248,7 @@ class SpineWebComponentOverlay extends HTMLElement implements OverlayAttributes,
} }
private dprScale = 1; private dprScale = 1;
private scaleSkeletonDPR () { private updateWidgetScales () {
for (const widget of this.widgets) { for (const widget of this.widgets) {
// inside mode scale automatically to fit the skeleton within its parent // inside mode scale automatically to fit the skeleton within its parent
if (widget.mode !== "origin" && widget.fit !== "none") return; if (widget.mode !== "origin" && widget.fit !== "none") return;