fix(app): persist view after Fit / mindmap auto-fit #29

Merged
AhmedHanafy725 merged 1 commit from development_fit_persist_view into development 2026-04-21 12:32:50 +00:00
Member

Summary

Fix for issue #28: clicking the Fit toolbar button recenters and rescales the stage but never persists the result, so reload brought the board back to the last wheel/drag-saved view instead of the fitted view. Same fix for fitMindmapToView.

Closes #28

Changes

  • crates/hero_whiteboard_ui/static/web/js/whiteboard/app.js
    • zoomReset: added WhiteboardCanvas.saveView() at all three exit points (empty-board path, empty-bounding-box path, and the normal fit path).
    • fitMindmapToView: added WhiteboardCanvas.saveView() after the stage mutation.

Test Results

  • cargo check --workspace: pass
  • cargo clippy --workspace -- -D warnings: pass
  • cargo fmt --check: pass

Vanilla-JS change; needs manual verification in the browser.

Manual verification

  • Click Fit, then reload — board comes back at the fitted view.
  • Click Fit on an empty board, then reload — board comes back at 100% at the origin.
  • Open a mindmap-only view that auto-fits on load, then reload — board returns to the auto-fitted view.
## Summary Fix for issue #28: clicking the Fit toolbar button recenters and rescales the stage but never persists the result, so reload brought the board back to the last wheel/drag-saved view instead of the fitted view. Same fix for `fitMindmapToView`. ## Related Issue Closes https://forge.ourworld.tf/lhumina_code/hero_whiteboard/issues/28 ## Changes - `crates/hero_whiteboard_ui/static/web/js/whiteboard/app.js` - `zoomReset`: added `WhiteboardCanvas.saveView()` at all three exit points (empty-board path, empty-bounding-box path, and the normal fit path). - `fitMindmapToView`: added `WhiteboardCanvas.saveView()` after the stage mutation. ## Test Results - `cargo check --workspace`: pass - `cargo clippy --workspace -- -D warnings`: pass - `cargo fmt --check`: pass Vanilla-JS change; needs manual verification in the browser. ## Manual verification - [ ] Click Fit, then reload — board comes back at the fitted view. - [ ] Click Fit on an empty board, then reload — board comes back at 100% at the origin. - [ ] Open a mindmap-only view that auto-fits on load, then reload — board returns to the auto-fitted view.
fix(app): persist view after Fit / mindmap auto-fit
All checks were successful
CI / build (pull_request) Successful in 2m24s
ff29e4de0a
zoomReset (the Fit toolbar button) and fitMindmapToView both set
stage.scale and stage.position directly, but never called
WhiteboardCanvas.saveView. The resulting view was lost on reload — the
board came back at the previously-saved wheel/drag zoom instead of the
fitted view.

Call saveView at every exit point of zoomReset (empty-board path, empty
bounding-box path, and the normal fit path) and at the end of
fitMindmapToView.

#28
AhmedHanafy725 merged commit 4a84ca9fe6 into development 2026-04-21 12:32:50 +00:00
AhmedHanafy725 deleted branch development_fit_persist_view 2026-04-21 12:32:54 +00:00
Sign in to join this conversation.
No reviewers
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!29
No description provided.