Stabilize WebGL flip reveal handoff

This commit is contained in:
2026-06-10 15:10:57 +02:00
parent 97eab216b7
commit ef358c5cfd
6 changed files with 186 additions and 41 deletions
+15
View File
@@ -148,6 +148,9 @@ class BookTextureRendererModule extends BaseModule {
this.drawSpread(this.currentSpread);
});
this.addEventListener(document, 'book-texture:fast-forward', this.fastForwardAnimations);
this.addEventListener(document, 'webgl-book:reveal-committed', (event) => {
this.completeRevealBlockIds(event.detail?.blockIds || []);
});
this.addEventListener(document, 'ui:command', (event) => {
if (event.detail?.type === 'continue') this.fastForwardAnimations();
});
@@ -1081,6 +1084,18 @@ class BookTextureRendererModule extends BaseModule {
}
}
completeRevealBlockIds(blockIds = []) {
const ids = Array.isArray(blockIds) ? blockIds : [];
ids.forEach((blockId) => {
const id = String(blockId ?? '');
if (!id) return;
const animation = this.activeAnimations.get(id);
if (animation) animation.completed = true;
this.revealedBlockIds.add(id);
this.pendingRevealBlockIds.delete(id);
});
}
stopAnimations() {
this.activeAnimations.clear();
this.pendingRevealBlockIds.clear();