mirror of
https://github.com/john-okeefe/foliate-js.git
synced 2026-09-09 11:29:14 -04:00
Fix keyboard 0 not resetting zoom in fixed-layout books
When pressing 0 to reset zoom, the code was calling
removeAttribute('zoom') on the renderer, which removed the DOM
attribute but left the internal zoom/transform state stale. This meant
subsequent zoom operations would compound on the old hidden state.
Replace with the new resetZoom() method that properly clears the
numeric zoom and triggers a clean re-render.
This commit is contained in:
@@ -209,7 +209,7 @@ class Reader {
|
||||
renderer instanceof FixedLayout,
|
||||
);
|
||||
if (renderer instanceof FixedLayout) {
|
||||
renderer.removeAttribute("zoom");
|
||||
renderer.resetZoom();
|
||||
renderer.dragOffset = { x: 0, y: 0 };
|
||||
$("#zoom-reset").textContent = "100%";
|
||||
console.log("[Reader Debug] ✅ Zoom reset");
|
||||
@@ -346,7 +346,7 @@ class Reader {
|
||||
console.log("[Reader Debug] 🔄 Reset zoom via keyboard");
|
||||
const renderer = this.view.renderer;
|
||||
if (renderer instanceof FixedLayout) {
|
||||
renderer.removeAttribute("zoom");
|
||||
renderer.resetZoom();
|
||||
renderer.dragOffset = { x: 0, y: 0 };
|
||||
$("#zoom-reset").textContent = "100%";
|
||||
console.log("[Reader Debug] ✅ Keyboard zoom reset");
|
||||
|
||||
Reference in New Issue
Block a user