From bd98d7e18592bb145656b271de52db694d0e1b11 Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Fri, 17 Apr 2026 16:59:26 -0400 Subject: [PATCH] Add scroll position and source context to zoom/pan event data in FixedLayout This commit enhances the FixedLayout component by including additional contextual information when zoom or pan operations occur: - scrollLeft and scrollTop: Current scroll position of the viewport - source: Origin of the zoom/pan action (e.g., mouse wheel, pinch zoom, button) - leftWidth: Width of the left page/panel in dual-page layouts These parameters provide downstream handlers with complete state information needed to implement sophisticated zoom behaviors, such as: - Preserving scroll position during zoom operations - Differentiating between user-initiated and programmatic zoom changes - Handling asymmetric layouts with different panel widths This change is part of the ongoing zoom control implementation for fixed-layout e-books. --- fixed-layout.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fixed-layout.js b/fixed-layout.js index 0d815c5..2964db2 100644 --- a/fixed-layout.js +++ b/fixed-layout.js @@ -288,8 +288,12 @@ export class FixedLayout extends HTMLElement { cursorY, dragOffsetX: this.dragOffset.x, dragOffsetY: this.dragOffset.y, + scrollLeft: this.scrollLeft, + scrollTop: this.scrollTop, newScrollX, newScrollY, + source, + leftWidth, }); // Apply zoom this.setAttribute("zoom", newScale);