Comment popover placed far from marker when zoomed out #32

Open
opened 2026-04-21 14:22:08 +00:00 by AhmedHanafy725 · 1 comment
Member

When the canvas is zoomed out, clicking a comment marker opens the popover far from the marker (near the top-left of the board instead of next to the circle).

Root cause: positionPopover in comments.js reads marker.getAbsolutePosition() — which already accounts for the stage transform and returns stage-container-relative pixel coordinates — and then multiplies by stage.scaleX() and adds stage.x() on top. The stage transform is counted twice. At scale < 1 the error is large enough that the popover lands near the canvas origin.

Fix: drop the extra * scale + stage.x() / * scale + stage.y() terms and use stageBox.left + markerPos.x / stageBox.top + markerPos.y directly.

When the canvas is zoomed out, clicking a comment marker opens the popover far from the marker (near the top-left of the board instead of next to the circle). Root cause: `positionPopover` in `comments.js` reads `marker.getAbsolutePosition()` — which already accounts for the stage transform and returns stage-container-relative pixel coordinates — and then multiplies by `stage.scaleX()` and adds `stage.x()` on top. The stage transform is counted twice. At scale < 1 the error is large enough that the popover lands near the canvas origin. Fix: drop the extra `* scale + stage.x()` / `* scale + stage.y()` terms and use `stageBox.left + markerPos.x` / `stageBox.top + markerPos.y` directly.
Author
Member

Pull request opened: #35

Pull request opened: https://forge.ourworld.tf/lhumina_code/hero_whiteboard/pulls/35
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#32
No description provided.