Restore WebGL book quality settings

This commit is contained in:
2026-06-07 11:13:05 +02:00
parent 777e39a650
commit 1b593c8c7b
6 changed files with 247 additions and 69 deletions
+9 -1
View File
@@ -53,6 +53,7 @@ class BookTextureRendererModule extends BaseModule {
'publishSpread',
'getPageCanvas',
'getHitMap',
'handlePageCountChanged',
'handleSceneReady'
]);
}
@@ -64,6 +65,7 @@ class BookTextureRendererModule extends BaseModule {
this.reportProgress(20, 'Preparing page texture canvases');
this.createPageCanvases();
this.drawEmptySpread();
this.addEventListener(document, 'webgl-book:page-count-changed', this.handlePageCountChanged);
this.addEventListener(document, 'webgl-book:scene-ready', this.handleSceneReady);
this.addEventListener(document, 'book-pagination:spread-updated', (event) => {
const latestBlockId = event.detail?.latestBlockId;
@@ -84,7 +86,7 @@ class BookTextureRendererModule extends BaseModule {
return true;
}
createPageCanvases(textureWidth = 1280) {
createPageCanvases(textureWidth = 3072) {
this.metrics = this.pageFormat.getTextureMetrics(textureWidth);
['left', 'right'].forEach((side) => {
const canvas = document.createElement('canvas');
@@ -408,6 +410,12 @@ class BookTextureRendererModule extends BaseModule {
return this.hitMaps[side] || [];
}
handlePageCountChanged(event) {
this.pageFormat?.setPageCount?.(event.detail?.pageCount);
this.createPageCanvases();
this.drawSpread(this.currentSpread || this.pagination?.getCurrentSpread?.());
}
handleSceneReady() {
this.publishSpread();
}