mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 14:24:53 +08:00
Allow multiple widgets for the same HTMLElement
This commit is contained in:
parent
f9bada6d0c
commit
2b6e1ff578
@ -1149,18 +1149,19 @@ class SpineWebComponentOverlay extends HTMLElement implements OverlayAttributes,
|
||||
|
||||
this.intersectionObserver = new IntersectionObserver((widgets) => {
|
||||
widgets.forEach(({ isIntersecting, target, intersectionRatio }) => {
|
||||
const widget = this.skeletonList.find(w => w.getHTMLElementReference() == target);
|
||||
if (!widget) return;
|
||||
this.skeletonList.forEach(widget => {
|
||||
if (widget.getHTMLElementReference() != target) return;
|
||||
|
||||
// old browsers do not have isIntersecting
|
||||
if (isIntersecting === undefined) {
|
||||
isIntersecting = intersectionRatio > 0;
|
||||
}
|
||||
// old browsers do not have isIntersecting
|
||||
if (isIntersecting === undefined) {
|
||||
isIntersecting = intersectionRatio > 0;
|
||||
}
|
||||
|
||||
widget.onScreen = isIntersecting;
|
||||
if (isIntersecting) {
|
||||
widget.onScreenFunction(widget);
|
||||
}
|
||||
widget.onScreen = isIntersecting;
|
||||
if (isIntersecting) {
|
||||
widget.onScreenFunction(widget);
|
||||
}
|
||||
});
|
||||
})
|
||||
}, { rootMargin: "30px 20px 30px 20px" });
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user