diff --git a/spine-ts/spine-webgl/src/SpineWebComponentWidget.ts b/spine-ts/spine-webgl/src/SpineWebComponentWidget.ts index 27236282d..6bf2eb1b1 100644 --- a/spine-ts/spine-webgl/src/SpineWebComponentWidget.ts +++ b/spine-ts/spine-webgl/src/SpineWebComponentWidget.ts @@ -561,6 +561,7 @@ export class SpineWebComponentWidget extends HTMLElement implements Disposable, */ public cursorBoundsEventCallback = (event: CursorEventTypes, originalEvent?: UIEvent) => { } + // TODO: probably it makes sense to associate a single callback to a groups of slots to avoid the same callback to be called for each slot of the group /** * This methods allows to associate to a Slot a callback. For these slots, if the widget is interactive, * when the cursor performs actions within the slot's attachment the associated callback is invoked with @@ -1185,13 +1186,6 @@ export class SpineWebComponentWidget extends HTMLElement implements Disposable, const { slotFunction, inside } = interactionState - if (type === "down" || type === "up") { - if (inside) { - slotFunction(slot, type, originalEvent); - } - continue; - } - let vertices = this.verticesTemp; let hullLength = 8; @@ -1213,6 +1207,13 @@ export class SpineWebComponentWidget extends HTMLElement implements Disposable, slotFunction(slot, "enter", originalEvent); } + if (type === "down" || type === "up") { + if (interactionState.inside) { + slotFunction(slot, type, originalEvent); + } + continue; + } + slotFunction(slot, type, originalEvent); } else {