Fit button: webframe iframe overlay does not follow the frame to its fitted position #118
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_whiteboard#118
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Click the Fit button (zoom reset to fit all content) on a board that has a webframe object. The Konva frame moves to its new position, but the iframe DOM overlay stays at its old screen position — the website pane visibly shifts away from the frame.
Steps to reproduce
WhiteboardApp.zoomReset()).Expected
The iframe overlay re-anchors to the frame's new screen position; frame and website stay aligned.
Actual
The frame redraws at the fitted position; the iframe overlay stays where it was.
Root cause
crates/hero_whiteboard_ui/static/web/js/whiteboard/canvas.js::setZoomalready callsWhiteboardWebframe.refreshAllOverlays()after applying scale/position. Butcrates/hero_whiteboard_ui/static/web/js/whiteboard/app.js::zoomResetbypassessetZoomand mutatesstage.scale/stage.positiondirectly, then callssyncScaleFromStage/drawGrid/saveView— but notrefreshAllOverlays. Two of the three branches insidezoomReset(the empty-bbox fallback and the normal fit) take this direct path; the empty-board branch routes throughsetZoomand is fine.Fix
Call
WhiteboardWebframe.refreshAllOverlays()after the directstage.scale/stage.positionmutations inzoomReset(the two branches that don't already route throughsetZoom).Implementation Spec for Issue #118
Objective
The Fit button (
zoomReset) must re-anchor every webframe iframe overlay to its frame's new screen position, the same waysetZoomalready does. Today only the empty-board branch routes throughsetZoom; the other two branches mutatestagedirectly and skip the overlay refresh, so iframes visibly shift away from their frames.Files to Modify
crates/hero_whiteboard_ui/static/web/js/whiteboard/app.js— append aWhiteboardWebframe.refreshAllOverlays()call to the two branches ofzoomResetthat mutatestage.scale/stage.positiondirectly. The empty-board branch (which already routes throughsetZoom) is already correct.Implementation Plan
Step 1: Refresh overlays after direct stage transforms
File:
crates/hero_whiteboard_ui/static/web/js/whiteboard/app.jsTwo spots inside
zoomResetapply the stage transform directly and end withsaveView():After each, add (defensively guarded against the module not being loaded):
The empty-board branch (lines ~642–647) already calls
WhiteboardCanvas.setZoom(1), which internally refreshes overlays — leave it untouched.Dependencies: none.
Acceptance Criteria
+/-keyboard zoom (which goes throughsetZoom) still works as before.cargo fmt,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspace --libclean.Notes
zoomResetto route throughsetZoom:setZoomdoesn't accept an explicit position, only a scale. Threading position through it (or duplicating logic) is a larger change than this two-line patch warrants.zoomReset: the only other direct stage mutator isfitMindmapToView, which lives in the standalone mindmap fullscreen view where webframes don't render. Out of scope.Test Results
cargo fmt --all -- --check— cleancargo clippy --workspace --all-targets -- -D warnings— cleancargo test --workspace --lib— 0 failednode --check app.js— cleanImplementation Summary
zoomReset(Fit) was applying the stage transform directly in two of its three branches and skipping the iframe-overlay refresh thatsetZoomalready performs. The webframe stayed at its old screen position while its Konva frame moved to the fitted position.crates/hero_whiteboard_ui/static/web/js/whiteboard/app.jsAdded a
WhiteboardWebframe.refreshAllOverlays()call after the stage transform in:The empty-board branch already routes through
WhiteboardCanvas.setZoom(1), which internally refreshes overlays — left untouched.Files Changed
crates/hero_whiteboard_ui/static/web/js/whiteboard/app.js—+6 / 0Test Results
cargo fmt --all -- --check— cleancargo clippy --workspace --all-targets -- -D warnings— cleancargo test --workspace --lib— 0 failednode --check app.js— cleanManual smoke
+/-keyboard zoom (already routed throughsetZoom) unchanged.Notes
zoomResetto route throughsetZoom:setZoomaccepts only a scale, not a position; threading position through would be a larger change than this two-line patch warrants.fitMindmapToViewnot touched — it lives in the standalone mindmap fullscreen view where webframes don't render.