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.
This commit is contained in:
2026-04-17 16:59:26 -04:00
parent 60332911e6
commit bd98d7e185
+4
View File
@@ -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);