fix(kanban): eliminate resize snapback and lower shrink minimums #63

Merged
AhmedHanafy725 merged 1 commit from development_kanban_resize_snapback_and_minimums into development 2026-04-23 08:23:53 +00:00
Member

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.

Closes #50

Changes

  • crates/hero_whiteboard_ui/static/web/js/whiteboard/tools.js — The existing transform live-redraw handler, which previously only covered calendars, now also handles kanban. On each tick the current Konva scale is multiplied into colWidth/cardHeight, the group scale is reset to 1, and WhiteboardKanban.redraw re-renders. This eliminates the size jump on release because the transformend render is the same render that was already visible during the last transform tick. The calendar branch is unchanged.
  • crates/hero_whiteboard_ui/static/web/js/whiteboard/objects.jsapplyTransform kanban clamp updated from Math.max(80, ...) / Math.max(24, ...) to Math.max(100, ...) / Math.max(22, ...), matching the sliders. With the live redraw, applyTransform becomes 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.jsprop-kanban-col-width min 140→100, prop-kanban-card-height min 30→22.

Why the snapback existed

renderKanban computes totalW = (N+0.5)*colW + (N+2)*padding and totalH = 94 + 6K + K*cardH — both have a scale-dependent term and a scale-independent constant (padding, header, card-gap, + Column slot, footer). Konva scales all children uniformly during a transform drag, so the visible box grows or shrinks by scale * old_size. The old implementation only scaled colW/cardH into state on release, after which renderKanban recomputed the box with unscaled constants — producing a delta of roughly constants * (scale − 1). Doing the scale-to-state conversion on every transform tick keeps the drag preview and the final render identical.

Test Results

  • cargo check --workspace: pass
  • cargo test --workspace --lib: pass
  • cargo clippy --workspace -- -D warnings: pass
  • cargo fmt --check: pass

Manual QA against a running UI is required for the visual no-jump criterion and the new minima.

## 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 https://forge.ourworld.tf/lhumina_code/hero_whiteboard/issues/50 ## Changes - `crates/hero_whiteboard_ui/static/web/js/whiteboard/tools.js` — The existing `transform` live-redraw handler, which previously only covered calendars, now also handles kanban. On each tick the current Konva scale is multiplied into `colWidth`/`cardHeight`, the group scale is reset to 1, and `WhiteboardKanban.redraw` re-renders. This eliminates the size jump on release because the `transformend` render is the same render that was already visible during the last `transform` tick. The calendar branch is unchanged. - `crates/hero_whiteboard_ui/static/web/js/whiteboard/objects.js` — `applyTransform` kanban clamp updated from `Math.max(80, ...)` / `Math.max(24, ...)` to `Math.max(100, ...)` / `Math.max(22, ...)`, matching the sliders. With the live redraw, `applyTransform` becomes 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-width` `min` 140→100, `prop-kanban-card-height` `min` 30→22. ## Why the snapback existed `renderKanban` computes `totalW = (N+0.5)*colW + (N+2)*padding` and `totalH = 94 + 6K + K*cardH` — both have a scale-dependent term and a scale-independent constant (padding, header, card-gap, `+ Column` slot, footer). Konva scales all children uniformly during a transform drag, so the visible box grows or shrinks by `scale * old_size`. The old implementation only scaled `colW`/`cardH` into state on release, after which `renderKanban` recomputed the box with unscaled constants — producing a delta of roughly `constants * (scale − 1)`. Doing the scale-to-state conversion on every `transform` tick keeps the drag preview and the final render identical. ## Test Results - `cargo check --workspace`: pass - `cargo test --workspace --lib`: pass - `cargo clippy --workspace -- -D warnings`: pass - `cargo fmt --check`: pass Manual QA against a running UI is required for the visual no-jump criterion and the new minima.
fix(kanban): eliminate resize snapback and lower shrink minimums
All checks were successful
CI / build (pull_request) Successful in 2m9s
1686120930
Extend the existing transform live-redraw handler to also cover kanban
so that scale is converted into colWidth/cardHeight state on every
tick. Previously only colWidth/cardHeight were scaled into state on
transformend, while the padding/header/gap constants were scaled
uniformly during drag and reverted on release — producing a visible
size jump. Align the minimum clamps in applyTransform and the
property-panel sliders at colWidth 100 and cardHeight 22 so the two
resize paths stay consistent.

#50
AhmedHanafy725 merged commit 239292dcb7 into development 2026-04-23 08:23:53 +00:00
AhmedHanafy725 deleted branch development_kanban_resize_snapback_and_minimums 2026-04-23 08:23:57 +00:00
Sign in to join this conversation.
No reviewers
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!63
No description provided.