mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
Fix widget using overlay before overlay webcomponent is fully upgraded.
This commit is contained in:
parent
6fa149756a
commit
8cc5a2ba5e
@ -530,7 +530,7 @@ export class SpineWebComponentWidget extends HTMLElement implements Disposable,
|
|||||||
throw new Error("You cannot attach a disposed widget");
|
throw new Error("You cannot attach a disposed widget");
|
||||||
};
|
};
|
||||||
|
|
||||||
this.overlay.addWidget(this);
|
customElements.whenDefined("spine-overlay").then(() => this.overlay.addWidget(this));
|
||||||
if (!this.manualStart && !this.started) {
|
if (!this.manualStart && !this.started) {
|
||||||
this.start();
|
this.start();
|
||||||
}
|
}
|
||||||
@ -538,12 +538,10 @@ export class SpineWebComponentWidget extends HTMLElement implements Disposable,
|
|||||||
}
|
}
|
||||||
|
|
||||||
disconnectedCallback (): void {
|
disconnectedCallback (): void {
|
||||||
this.loadingPromise?.then(() => {
|
const index = this.overlay.skeletonList.indexOf(this);
|
||||||
const index = this.overlay.skeletonList.indexOf(this);
|
if (index !== -1) {
|
||||||
if (index !== -1) {
|
this.overlay.skeletonList.splice(index, 1);
|
||||||
this.overlay.skeletonList.splice(index, 1);
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
this.debugDragDiv?.remove();
|
this.debugDragDiv?.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -573,7 +571,8 @@ export class SpineWebComponentWidget extends HTMLElement implements Disposable,
|
|||||||
}
|
}
|
||||||
this.started = true;
|
this.started = true;
|
||||||
|
|
||||||
this.loadingPromise = this.loadSkeleton();
|
this.loadingPromise = customElements.whenDefined("spine-overlay").then(() => this.loadSkeleton());
|
||||||
|
|
||||||
this.loadingPromise.then(() => {
|
this.loadingPromise.then(() => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user