Resize handles too small / hard to grab #21
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_whiteboard#21
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?
The resize hit area at the widget corners is too small. easy to miss, as shown in the video.
Implementation Spec for Issue #21
Objective
Make the transformer's resize anchors comfortable to grab without making them look chunky. Keep the visual anchor size modest; expand only the hit area.
Root cause
The transformer is configured with
anchorSize: 8intools.js:46, smaller than Konva's own default of 10. On the attached video the user clearly mis-clicks an anchor; the 8 px hit box is too tight especially on high-DPI displays and with a trackpad. Both the visual and the pickable area are currently the same square.Requirements
boundBoxFunc,rotateEnabled,keepRatio, colours, or any other transformer behaviour.Files to Modify
crates/hero_whiteboard_ui/static/web/js/whiteboard/tools.js— bump the visibleanchorSizeslightly and install a per-anchorhitFuncso every anchor has a padded hit box.Implementation Plan
Step 1: Bump visible anchor size and install padded hitFunc
Files:
crates/hero_whiteboard_ui/static/web/js/whiteboard/tools.jsanchorSize: 8toanchorSize: 10(Konva default). Visually almost identical, gives a hair more headroom.layer.add(transformer), iterate every anchor shape (transformer.find('._anchor')) and overridehitFuncso each anchor draws a padded hit rectangle:init()so it shares closure withtransformer. No new module-level state.Dependencies: none
Acceptance Criteria
boundBoxFunc) do not overlap into a single indistinguishable hit zone; corner-vs-edge pick still works.Notes
transformer.find('._anchor')is the documented Konva selector for the anchor shapes, including the rotation handle. Using it avoids hard-coding per-anchor names.transformevent is cheap (eight shape walks + one hitFunc assignment each) and guarantees correctness when Konva rebuilds anchors — for example, when the selected node set changes viatransformer.nodes([...]).HIT_PAD: 6was picked as a balance; if testing shows it still feels tight, bumping to 8 is safe — atanchorSize: 10andHIT_PAD: 8the hit box is 26 px, still smaller than the minimum 40 px object width so corner and edge anchors remain distinguishable.Test Results
cargo check --workspace: passcargo clippy --workspace -- -D warnings: passcargo fmt --check: passChanges are entirely in vanilla JS (tools.js); Rust workspace is unaffected. UI behavior needs manual verification in the browser.
Implementation Summary
Changes
crates/hero_whiteboard_ui/static/web/js/whiteboard/tools.jsanchorSizefrom 8 to 10 (Konva default).applyAnchorHitPadding()helper that walks every._anchorshape on the transformer and installs ahitFuncdrawing a padded rect (+6 px on every side, ~22x22 px total pickable area).transformevent and monkey-patchestransformer.nodesandtransformer.forceUpdateso the hit padding survives anchor rebuilds (selection changes, resize end, etc.).Test Results
cargo check --workspace: passcargo clippy --workspace -- -D warnings: passcargo fmt --check: passVanilla-JS change; needs manual verification in the browser.
Manual verification checklist
Pull request opened: #27
This PR implements the changes discussed in this issue.