Fit (zoom-to-fit) state is not persisted across reload #28

Open
opened 2026-04-21 12:15:16 +00:00 by AhmedHanafy725 · 1 comment
Member

Clicking the Fit button in the zoom toolbar re-centers and rescales the stage to fit all content, but the resulting zoom/pan is not written to localStorage. After a page reload the board comes back at its previously-saved view (from the last wheel/drag/setZoom) instead of the fitted view.

Root cause: WhiteboardApp.zoomReset() in app.js sets stage.scale(...) and stage.position(...) directly without calling WhiteboardCanvas.saveView(). The same issue exists in fitMindmapToView() (used by the mindmap fullscreen view).

Fix: call WhiteboardCanvas.saveView() at the end of both functions, and before each early-return that has already mutated the stage.

Clicking the Fit button in the zoom toolbar re-centers and rescales the stage to fit all content, but the resulting zoom/pan is not written to localStorage. After a page reload the board comes back at its previously-saved view (from the last wheel/drag/setZoom) instead of the fitted view. Root cause: `WhiteboardApp.zoomReset()` in `app.js` sets `stage.scale(...)` and `stage.position(...)` directly without calling `WhiteboardCanvas.saveView()`. The same issue exists in `fitMindmapToView()` (used by the mindmap fullscreen view). Fix: call `WhiteboardCanvas.saveView()` at the end of both functions, and before each early-return that has already mutated the stage.
Author
Member

Pull request opened: #29

Pull request opened: https://forge.ourworld.tf/lhumina_code/hero_whiteboard/pulls/29
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_whiteboard#28
No description provided.