Stabilize WebGL flip reveal handoff
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user