fix(kanban): eliminate resize snapback and lower shrink minimums #63
No reviewers
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!63
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "development_kanban_resize_snapback_and_minimums"
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
Resizing a kanban via the transformer handles no longer visibly jumps when the mouse is released, and both the sliders and the transformer can shrink a kanban to
colWidth = 100/cardHeight = 22.Related Issue
Closes #50
Changes
crates/hero_whiteboard_ui/static/web/js/whiteboard/tools.js— The existingtransformlive-redraw handler, which previously only covered calendars, now also handles kanban. On each tick the current Konva scale is multiplied intocolWidth/cardHeight, the group scale is reset to 1, andWhiteboardKanban.redrawre-renders. This eliminates the size jump on release because thetransformendrender is the same render that was already visible during the lasttransformtick. The calendar branch is unchanged.crates/hero_whiteboard_ui/static/web/js/whiteboard/objects.js—applyTransformkanban clamp updated fromMath.max(80, ...)/Math.max(24, ...)toMath.max(100, ...)/Math.max(22, ...), matching the sliders. With the live redraw,applyTransformbecomes a no-op for kanban in the normal drag path (its existing early-exit on scale≈1 triggers), so this remains a safety clamp.crates/hero_whiteboard_ui/static/web/js/whiteboard/properties.js—prop-kanban-col-widthmin140→100,prop-kanban-card-heightmin30→22.Why the snapback existed
renderKanbancomputestotalW = (N+0.5)*colW + (N+2)*paddingandtotalH = 94 + 6K + K*cardH— both have a scale-dependent term and a scale-independent constant (padding, header, card-gap,+ Columnslot, footer). Konva scales all children uniformly during a transform drag, so the visible box grows or shrinks byscale * old_size. The old implementation only scaledcolW/cardHinto state on release, after whichrenderKanbanrecomputed the box with unscaled constants — producing a delta of roughlyconstants * (scale − 1). Doing the scale-to-state conversion on everytransformtick keeps the drag preview and the final render identical.Test Results
cargo check --workspace: passcargo test --workspace --lib: passcargo clippy --workspace -- -D warnings: passcargo fmt --check: passManual QA against a running UI is required for the visual no-jump criterion and the new minima.