Fixed issues with slot events on mobile.

This commit is contained in:
Davide Tantillo 2025-03-28 17:40:38 +01:00
parent c8b0272ca8
commit 49afa43d8f

View File

@ -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 {