Mind map node edit input is unreadable at low zoom #152
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#152
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?
When editing a mind-map node (double-click to edit text) while the canvas is zoomed out, the edit input box renders tiny because it scales with the canvas zoom. The visible node is much larger than the input that sits on top of it, making it hard to read what is being typed.
Expected
The edit input should be readable at any zoom level — comparable to how the comment popover renders at a fixed DOM size and stays readable regardless of canvas zoom.
Actual
The input shrinks with the canvas zoom and becomes unreadable when zoomed out. See screenshot — the small "New Node" box at the top-left is the actual edit input; the large rounded shape behind it is the actual node.
Repro
Implementation Spec
Root cause
Two edit-input builders in
crates/hero_whiteboard_ui/static/web/js/whiteboard/mindmap.jssize their DOM<input>elements by multiplying canvas pixels by the current Konva stage scale, so they shrink with zoom level instead of staying at a fixed screen size:editMindmapTitle(~lines 430–468) — title editor.width = 200 * stageScale,height = 24 * stageScale,fontSize = 16 * stageScale.editMindmapNode(~lines 639–678) — per-node editor.width = NODE_W(140) * stageScale,height = NODE_H(36) * stageScale,fontSize = 12 * stageScale.When
stageScale < 1(zoomed out) the input collapses (font becomes ~3–4px) while the underlying Konva node looks visually unchanged on screen. Screen-space size of the input should be constant; only the position should depend on the absolute transform.The pattern was already corrected for the comment popup
showCommentPopup(uses.comment-popoverCSS class with screen-fixed sizing, computes screen position viagetAbsoluteTransform().point(...)plusstageBox). That is the model to mirror.Files to Modify
crates/hero_whiteboard_ui/static/web/js/whiteboard/mindmap.js— only file with code changes.No CSS changes required — reuse existing
.konva-text-editrule and--wb-*CSS variables already defined inwhiteboard.css.Implementation Plan
Step 1: Fix screen-fixed sizing in both edit-input builders
Files:
mindmap.jsgetAbsoluteTransform().point(...)+stageBox) stays as-is.width = Math.max(NODE_W * stageScale, 160) + 'px'width = Math.max(200 * stageScale, 200) + 'px'28pxnode,32pxtitle). Do not multiply by scale.'14px'node (matches comment popover typography),'15px'bold for title.--wb-*CSS variables:background: var(--wb-surface)(opaque —.konva-text-edithasbackground: transparent, must override so the giant zoomed node doesn't bleed through)color: var(--wb-text)(title editor preservesgroup._mmState.tree.coloroverride)border: 1px solid var(--wb-border),borderRadius: 4px,padding: 4px 8pxoutline: 2px solid var(--wb-primary)className = 'konva-text-edit'on the node editor.Dependencies: none
Acceptance Criteria
Behaviors that MUST be preserved
nodeData.text/group._mmState.titlefocus()+select()on openrenderMindmap(group), removes DOM,WhiteboardSync.onUpdate(group)e.stopPropagation()in keydown — global shortcuts must not intercept typingeditMindmapTitlepreservedgetAbsoluteTransform+stageBox) unchangedNotes
Task description's mention of "add new node auto-focus + immediate edit flow" is aspirational —
addChildToNodedoes not currently calleditMindmapNode. Out of scope for this fix.Validation
mindmap.js)cargo check --workspacecargo test --workspace --libImplementation summary
Changes
crates/hero_whiteboard_ui/static/web/js/whiteboard/mindmap.js— fixed botheditMindmapTitleandeditMindmapNodeso the edit input has a screen-fixed size that does not shrink with canvas zoom.Math.max(NODE_W * scale, 160)for nodes,Math.max(200 * scale, 200)for the title).28pxnode,32pxtitle) — no zoom multiplier.14pxnode,15pxbold title) — no zoom multiplier.mindmap-comment-*theme tokens to--wb-*CSS variables (--wb-surface,--wb-text,--wb-border,--wb-primary) that match the rest of the app and re-theme automatically.var(--wb-surface)) so the giant zoomed-up node behind doesn't bleed through. The.konva-text-editrule's2px solid var(--wb-primary)focus outline now actually shows on the node editor (the previous inlineoutline: 'none'was suppressing it).renderMindmap+WhiteboardSync.onUpdate),e.stopPropagation(), lock checks, and the title-color override are all preserved.Validation
cargo check --workspace: passcargo test --workspace --lib: passNotes
This is a UI-only change. Confirm visually by zooming the canvas to ~40% and double-clicking a mind-map node — the edit input should render at the same on-screen size and font as it does at 100%.