From b26cde2527a6903d84766b0d1d3d1abf2d22f89f Mon Sep 17 00:00:00 2001 From: John Factotum <50942278+johnfactotum@users.noreply.github.com> Date: Tue, 10 Jun 2025 20:51:27 +0800 Subject: [PATCH] FXL: don't use book viewport if it's empty Fixes https://github.com/johnfactotum/foliate-js/issues/52#issuecomment-2956113877 --- fixed-layout.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fixed-layout.js b/fixed-layout.js index 21a536a..c582aba 100644 --- a/fixed-layout.js +++ b/fixed-layout.js @@ -18,7 +18,7 @@ const getViewport = (doc, viewport) => { // fallback to book's viewport if (typeof viewport === 'string') return parseViewport(viewport) - if (viewport) return viewport + if (viewport?.width && viewport.height) return viewport // if no viewport (possibly with image directly in spine), get image size const img = doc.querySelector('img')