| Name | Modified | Size | Downloads / Week |
|---|---|---|---|
| Parent folder | |||
| 5.7.9_ Multi-Page to Single-Page View Return Auto-Focus, True Visual Centering _ Zoom Level Preservation source code.tar.gz | 2026-10-12 | 22.5 MB | |
| 5.7.9_ Multi-Page to Single-Page View Return Auto-Focus, True Visual Centering _ Zoom Level Preservation source code.zip | 2026-10-12 | 22.8 MB | |
| README.md | 2026-10-12 | 10.5 kB | |
| OpenPublisher-5-x86_64.AppImage | 2026-10-12 | 166.4 MB | |
| openpublisher5_amd64-windows-portable.exe | 2026-10-12 | 183.2 MB | |
| openpublisher5_amd64-windows.exe | 2026-10-12 | 165.2 MB | |
| openpublisher5_amd64-macos.dmg | 2026-10-12 | 233.1 MB | |
| openpublisher5_amd64-linux.run | 2026-10-12 | 193.4 MB | |
| openpublisher5_amd64-linux.rpm | 2026-10-12 | 215.4 MB | |
| openpublisher5_amd64-linux.flatpak | 2026-10-12 | 153.6 MB | |
| openpublisher5_amd64-linux.deb | 2026-10-12 | 156.2 MB | |
| openpublisher5_amd64-freebsd.pkg | 2026-10-12 | 185.5 MB | |
| Totals: 12 Items | 1.7 GB | 0 | |
π Summary
Version 5.7.9 resolves a viewport navigation and positioning defect occurring when returning from Multi-Page Overview to Single-Page editing mode inside the desktop client and standard browsers, while preserving user zoom levels and unifying document focus across all return pathways:
- Multi-Page Overview to Single-Page Return Auto-Focus: Fixed an issue where switching from Multi-Page Overview back to Single-Page view left the viewport stranded at the top-left pasteboard origin (
scrollLeft = 0, scrollTop = 0). In NW.js desktop client environments with wide pasteboard margins (marginLeft: 765px+), users were left looking at empty pasteboard and had to manually scroll right and down (or scroll until the floating return button appeared) to locate their document. Returning to single-page view now automatically centers and focuses directly on the active document with 0px offset. - Universal Return Pathway Centering: Unifies all exit paths from multi-page view (
setViewMode('single'), ribbon "Single" button, status bar "Single" button, double-clicking a thumbnail slot, pressing Enter on a slot, pressing Esc, or callingfocusPage()) through an automated centering pipeline insideexitMultiPageView(). - True Visual Document Centering: Centering calculations dynamically determine the true visual center of
#paper(paper.offsetLeft + paper.offsetWidth / 2), taking into account NW.js host wrapper margins (marginLeft: 765px+), flexbox layouts, and custom pan offsets, ensuring the page lands symmetrically in the center of the viewport across all environments. - Instant View Mode Transition: Enhanced
returnToPage(instant)to support immediate zero-delay repositioning (behavior: 'auto') on view mode transitions, eliminating disorienting 500ms glide animations across empty pasteboard space. - Zoom Level Preservation Across View Modes: When entering multi-page overview, the editor now preserves the user's prior single-page editing zoom (
_preMultiPageZoom) and restores it upon exiting multi-page view, automatically synchronizing both the ribbon zoom slider and percentage indicator. - Double-Shot Margin Reflow Synchronization: Scheduled secondary micro-syncs at 30ms and 100ms in
exitMultiPageView()to ensure that asynchronous NW.js host wrapper margin recalculations and MutationObserver reflows remain centered with 0px offset. - Page Switch Execution Ordering: In
openPageInSingleMode(index), fixed the execution order to ensureswitchPage(index)runs before view mode switching, guaranteeing that target page content serializes and renders cleanly. - Defensive Dialog Overlay Initialization: Added lazy overlay initialization to
DialogSystem.show()inui/ui.jsso that opening dialogs or modals prior to explicit DOM setup never throws null overlay reference exceptions. - Adaptive Fit-to-Page & Fit-to-Width Calculations: Updated
fitToPage()andfitToWidth()incanvas/canvas.jsto compute horizontal centering based onpaperVisualCenterwhenever custom pasteboard margins are active. - Full Subsystem & Cache Synchronization: Synchronized all 83 asset cachebusters to
?v=5.7.9inindex.html, bumped Service Worker cache namespace toopen-publisher-v5-7-9, and updated all subsystem headers, logs, and about dialogs.
π Root Cause Analysis & Technical Implementation
1. The Multi-Page to Single-Page View Return Defect
- Failure Mode in NW.js: Inside the NW.js desktop client (
wrapper.html), the host injects wide margins into#paper(paper.style.marginLeft = marginH + 'px', typically 765px to 1282px) withviewport.style.justifyContent = 'flex-start'. When the user enters multi-page overview (setViewMode('multipage')),#paperis hidden,#multi-page-wrapperis created, and zoom is set to ~0.35. When exiting back to single-page view,exitMultiPageView()previously made#papervisible and removed the multi-page wrapper, but never touchedviewport.scrollLeftorviewport.scrollTop. - As a consequence,
viewport.scrollLeftremained at0andviewport.scrollTopat0(the far top-left corner of the pasteboard), while#papersat atmarginLeft = 765px+, forcing the user to manually scroll right and down or hunt for the document. - The Solution:
- Integrated
returnToPage(true)directly intoexitMultiPageView()right after unhiding#paperand re-rendering the active page. - In
returnToPage(instant = false), implemented aninstantflag that usesscrollBehavior = instant ? 'auto' : 'smooth'. For view switches, instant scrolling immediately places the viewport over the page without any visual gliding delay. - Calculated exact horizontal center:
targetScrollLeft = Math.max(0, Math.min(vp.scrollWidth - vpW, Math.round(paperVisualCenter - (vpW / 2))))wherepaperVisualCenter = paper.offsetLeft + (paper.offsetWidth / 2). - Calculated exact vertical top:
targetScrollTop = paperVisualTop <= 60 ? 0 : Math.max(0, Math.min(vp.scrollHeight - vpH, Math.round(paperVisualTop - 50))), placing the document cleanly at the 50px top padding origin aligned with the vertical ruler.
2. Zoom Level Overwrite & Restoration
- Failure Mode: When entering multi-page overview,
enterMultiPageView()overwrotestate.zoomwith overview zoom (~0.35). Upon returning to single-page view,exitMultiPageView()previously appliedscale(${state.zoom}), leaving the document stranded at overview zoom (35%) rather than the user's prior editing magnification (e.g. 100% or 60%). - The Solution:
- In
enterMultiPageView(), stored the active zoom inwindow._preMultiPageZoombefore applying overview zoom. - In
exitMultiPageView(), restoredstate.zoom = window._preMultiPageZoom(defaulting to 1.0 or existing zoom if valid), cleaned up_preMultiPageZoom, updated#zoom-sliderwith aninputevent dispatch, and updated#zoom-level-display.
3. Asynchronous NW.js Host Wrapper Reflow Absorption
- Reflow Timing: In NW.js, host scripts or MutationObservers may compute updated margins on the subsequent animation frame or event loop tick after DOM changes.
- The Solution: Scheduled secondary micro-syncs at 30ms and 100ms in
exitMultiPageView():javascript setTimeout(() => { if (state && state.viewMode === 'single') window.returnToPage(true); }, 30); setTimeout(() => { if (state && state.viewMode === 'single') window.returnToPage(true); }, 100);This guarantees that once host margins reflow, the viewport rests at exactly 0px horizontal offset.
4. Page Switch Execution Ordering
- Failure Mode: In
window.openPageInSingleMode(index), the function previously assignedstate.currentPageIndex = indexbefore callingswitchPage(index). InsideswitchPage(newIndex), the guardif (newIndex === state.currentPageIndex) return;aborted page switching early, preventingrenderPage()and sidebar updates from executing for the new page. - The Solution: Updated
openPageInSingleModeto invokeswitchPage(index)directly whenstate.currentPageIndex !== index, ensuring the previous page serializes and the new page renders into the canvas prior to switching view mode.
5. Defensive DialogSystem Overlay Initialization
- Failure Mode: Calling
DialogSystem.show()beforeDialogSystem.init()had attached#custom-dialog-overlaytodocument.bodycaused an unhandledTypeError: overlay is nullin browser environments like Firefox. - The Solution: Added lazy initialization inside
DialogSystem.show():javascript let overlay = document.getElementById('custom-dialog-overlay'); if (!overlay) { this.init(); overlay = document.getElementById('custom-dialog-overlay'); } if (!overlay) return;
π Files Modified in 5.7.9
| File | Changes |
|---|---|
canvas/canvas.js |
Updated exitMultiPageView() to restore pre-overview zoom, unhide paper, re-render active page, and trigger immediate zero-delay visual centering via returnToPage(true) with secondary micro-syncs. Added instant parameter to returnToPage(). Saved _preMultiPageZoom in enterMultiPageView(). Fixed page switch ordering in openPageInSingleMode(). Updated fitToPage(), fitToWidth(), and focusPage() to align with paperVisualCenter. |
ui/ui.js |
Added lazy overlay initialization to DialogSystem.show() to prevent null overlay references if triggered prior to explicit initialization. |
index.html |
Synchronized all 83 asset cachebusters to ?v=5.7.9. |
sw.js |
Bumped Service Worker cache namespace to open-publisher-v5-7-9 and header comment to (v5.7.9). |
style.css |
Bumped header comments to (v5.7.9). |
extensions/ui-interactions.js |
Bumped About dialog subtitle to v5.7.9. |
extensions/pwa-install.js |
Bumped header to (v5.7.9) and Service Worker registration query to sw.js?v=5.7.9. |
ui/dashboard.js |
Updated template fetch cachebuster queries to ?v=5.7.9. |
extensions/legacy-fixes.js |
Bumped engine log to v5.7.9. |
extensions/print-engine.js |
Bumped print sequence log string to v5.7.9. |
ui/modals/options-modal.js |
Bumped header comment to (v5.7.9). |
ui/sidebar-context.js |
Bumped header comment to (v5.7.9). |
tools/proofing/spellcheck-engine.js |
Bumped header comment to (v5.7.9). |
β v5.7.9 Automated Test Verification
| Test Suite | Environment | Scenario | Result |
|---|---|---|---|
| Suite 1 | NW.js Guest Simulation | Switched from multi-page overview to single-page view via setViewMode('single') (ribbon / status bar / Esc key) |
PASSED (centerOffset: 0px, scrollTop: 0px, zoom: 0.6 restored, button hidden) |
| Suite 2 | NW.js Guest Simulation | Double-clicked slot 2 / called openPageInSingleMode(1) to switch to page 2 |
PASSED (centerOffset: 0px, scrollTop: 0px, currentPage: 1, button hidden) |
| Suite 3 | NW.js Guest Simulation | Called focusPage(2) from multi-page overview to focus page 3 |
PASSED (centerOffset: 0px, scrollTop: 0px, currentPage: 2, button hidden) |
| Cross-Browser Parity | Chromium & Firefox | Executed all 3 suites across both browser engines | 100% PASSED in both Chromium and Firefox |
π Version 5.7.9 - Open Publisher