Stage WebGL scene loading

This commit is contained in:
2026-06-07 12:08:13 +02:00
parent 1b593c8c7b
commit de81a7c5c5
7 changed files with 73 additions and 16 deletions
+9 -1
View File
@@ -36,6 +36,7 @@ class BookPaginationModule extends BaseModule {
'getSpread',
'getCurrentSpread',
'setCurrentSpread',
'handlePageCountChanged',
'publish'
]);
}
@@ -44,9 +45,10 @@ class BookPaginationModule extends BaseModule {
this.pageFormat = this.getModule('book-page-format');
this.paragraphLayout = this.getModule('paragraph-layout');
this.storyHistory = this.getModule('story-history');
this.metrics = this.pageFormat.getTextureMetrics(1280);
this.metrics = this.pageFormat.getTextureMetrics(this.pageFormat.getTextureWidth?.());
this.reportProgress(35, 'Preparing book pagination metrics');
this.addEventListener(document, 'webgl-book:page-count-changed', this.handlePageCountChanged);
this.addEventListener(document, 'story:history-updated', this.refreshFromHistory);
this.addEventListener(document, 'book-pagination:set-spread', (event) => {
this.setCurrentSpread(event.detail?.spreadIndex);
@@ -55,6 +57,12 @@ class BookPaginationModule extends BaseModule {
return true;
}
handlePageCountChanged(event) {
this.pageFormat?.setPageCount?.(event.detail?.pageCount);
this.metrics = this.pageFormat.getTextureMetrics(this.pageFormat.getTextureWidth?.());
this.refreshFromHistory();
}
async refreshFromHistory(event = null) {
const token = ++this.refreshToken;
const detail = event?.detail || {};