fix(kanban): select card with click and delete with Delete/Backspace #62

Merged
AhmedHanafy725 merged 4 commits from development_kanban_card_select_delete into development 2026-04-22 14:32:42 +00:00
Member

Summary

Kanban cards can now be selected by clicking them, and the selected card can be removed with Delete or Backspace. The existing whole-kanban delete path is preserved as a fallback when no card is internally selected.

Closes #48

Changes

  • crates/hero_whiteboard_ui/static/web/js/whiteboard/kanban.js
    • Added ephemeral internal selection state (_selectedColIdx, _selectedCardIdx) directly on the Konva group so it is NOT serialized by sync.js.
    • renderCard now draws the selected card with a blue accent stroke (#007AFF, width 2).
    • cardRect click/tap sets internal selection and re-renders; does not cancel bubbling, so the stage-level handler still transformer-selects the kanban group.
    • cardRect dragstart and the group's dragstart both clear internal selection so no stale accent survives a drag.
    • Background click/tap clears internal selection.
    • Stage-level namespaced click/tap listener clears internal selection when the user clicks outside the kanban; the listener is removed on group destroy to avoid leaks.
    • New deleteSelectedCard(group) helper mutates state, re-renders, refreshes the property panel, and calls WhiteboardSync.onUpdate(group); returns true on success, false if nothing selected. Exported on the public API.
  • crates/hero_whiteboard_ui/static/web/js/whiteboard/shortcuts.js
    • In the kanban branch of handleWidgetShortcut, intercept Delete/Backspace: if WhiteboardKanban.deleteSelectedCard(group) returns true, stop; otherwise return false so the outer handler falls through to WhiteboardTools.deleteSelected() and removes the whole kanban as before.

Test Results

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

JavaScript-only change; Rust checks confirm no regression. Manual verification will follow on a running UI per the spec's Step 6 checklist.

## Summary Kanban cards can now be selected by clicking them, and the selected card can be removed with Delete or Backspace. The existing whole-kanban delete path is preserved as a fallback when no card is internally selected. ## Related Issue Closes https://forge.ourworld.tf/lhumina_code/hero_whiteboard/issues/48 ## Changes - `crates/hero_whiteboard_ui/static/web/js/whiteboard/kanban.js` - Added ephemeral internal selection state (`_selectedColIdx`, `_selectedCardIdx`) directly on the Konva group so it is NOT serialized by `sync.js`. - `renderCard` now draws the selected card with a blue accent stroke (`#007AFF`, width 2). - `cardRect` click/tap sets internal selection and re-renders; does not cancel bubbling, so the stage-level handler still transformer-selects the kanban group. - `cardRect` dragstart and the group's dragstart both clear internal selection so no stale accent survives a drag. - Background click/tap clears internal selection. - Stage-level namespaced click/tap listener clears internal selection when the user clicks outside the kanban; the listener is removed on group `destroy` to avoid leaks. - New `deleteSelectedCard(group)` helper mutates state, re-renders, refreshes the property panel, and calls `WhiteboardSync.onUpdate(group)`; returns `true` on success, `false` if nothing selected. Exported on the public API. - `crates/hero_whiteboard_ui/static/web/js/whiteboard/shortcuts.js` - In the kanban branch of `handleWidgetShortcut`, intercept Delete/Backspace: if `WhiteboardKanban.deleteSelectedCard(group)` returns `true`, stop; otherwise return `false` so the outer handler falls through to `WhiteboardTools.deleteSelected()` and removes the whole kanban as before. ## Test Results - `cargo check --workspace`: pass - `cargo test --workspace`: pass - `cargo clippy --workspace -- -D warnings`: pass - `cargo fmt --check`: pass JavaScript-only change; Rust checks confirm no regression. Manual verification will follow on a running UI per the spec's Step 6 checklist.
fix(kanban): select card with click and delete with Delete/Backspace
All checks were successful
CI / build (pull_request) Successful in 2m10s
77dc160f88
#48
fix(kanban): ensure kanban is transformer-selected on card/bg click
All checks were successful
CI / build (pull_request) Successful in 2m8s
d046a13be6
Inside the click handlers, renderKanban() destroys the event target
before the stage-level handler in tools.js can walk its ancestor chain
to transformer-select the kanban group. As a result, a first card click
set the internal selection but did not select the kanban outline, so
Delete did nothing. Now the handlers set the transformer themselves
(mirroring the stage handler's behavior) before re-rendering.

#48
fix(kanban): let pointer events on card text pass through to the card rect
Some checks failed
CI / build (pull_request) Failing after 1s
7a6ed6f5a6
The card text node intercepted clicks and drags, so clicking on the
text (vs. empty card area) neither selected nor dragged the card. Set
listening: false on the text so all pointer events fall through to the
cardRect underneath, which owns the click/drag/dblclick handlers. The
now-redundant dblclick handler on cardText is removed.

#48
fix(kanban): drag whole card as a unit so text follows the rect
All checks were successful
CI / build (pull_request) Successful in 2m10s
a09b8d15f4
Wrap each card's rect, text, and menu in a per-card Konva.Group that
is the draggable unit. Previously only cardRect was draggable, so the
text and menu stayed at their old positions during drag and only
snapped into place on dragend.

#48
AhmedHanafy725 merged commit 6b058d8575 into development 2026-04-22 14:32:42 +00:00
AhmedHanafy725 deleted branch development_kanban_card_select_delete 2026-04-22 14:32:55 +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!62
No description provided.