fix(comments): eraser, properties pane, un-resolve, right-click, persistence #42

Merged
AhmedHanafy725 merged 4 commits from development_comment_batch_fixes into development 2026-04-21 15:28:40 +00:00
Member

Summary

Batch of six comment-related UX fixes addressing issues #36-#41.

  • Closes #36 — eraser deletes comments
  • Closes #37 — properties panel for comments
  • Closes #38 — un-resolve
  • Closes #39 — right-click no longer opens popover
  • Closes #40 — rotation persists
  • Closes #41 — scale persists

Changes

Server

  • crates/hero_whiteboard_server/src/migrations/005_comment_transform.sql (new) — adds rotation REAL NOT NULL DEFAULT 0 and scale REAL NOT NULL DEFAULT 1 columns to comments.
  • src/db/models.rs — extend Comment with rotation and scale.
  • src/db/queries.rscreate_comment, list_comments, update_comment read/write both columns; resolve_comment renamed to set_comment_resolved(conn, id, resolved, now).
  • src/handlers/comment.rscreate accepts optional rotation/scale; update accepts both (scale clamped to [0.2, 5.0]); resolve accepts resolved: bool (defaults to true — backwards compatible).
  • openrpc.jsoncomment.create, comment.update, comment.resolve documented with the new fields; Comment schema gains rotation + scale.

Client

  • static/web/js/whiteboard/comments.js
    • addCommentMarker applies comment.rotation and comment.scale on load.
    • Click handler short-circuits on e.evt.button !== 0 — right-click falls through.
    • setResolved(id, bool) helper powers resolveComment and new unresolveComment; popover renders Unresolve when comment.resolved.
    • New onTransformEnd(group) bakes uniform scale, clamps to [0.2, 5], persists {x, y, rotation, scale}, broadcasts via websocket.
    • handleSyncMessage applies incoming rotation/scale and handles comment.unresolved.
    • Exports unresolveComment, onTransformEnd, getComments.
  • static/web/js/whiteboard/tools.js
    • Transformer transformend routes comment markers to WhiteboardComments.onTransformEnd.
    • Eraser eraseAtPosition walks .comment-marker and deletes matches through WhiteboardComments.deleteComment.
  • static/web/js/whiteboard/properties.js
    • show() detects node.hasName('comment-marker') and renders a dedicated Comment pane (Position, Status, Text preview, Resolve/Unresolve + Delete).

Test Results

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

No Rust unit tests exist for this code path; behavior needs manual verification in the browser.

Manual verification

  • Eraser drag over a comment deletes it.
  • Selecting a comment shows the Comment pane; Resolve/Unresolve/Delete buttons work.
  • Resolved comment shows Unresolve in popover AND in properties pane; clicking flips state everywhere.
  • Right-click on a comment opens the canvas context menu only — not the popover.
  • Rotate a comment via the transformer, reload — rotation persists.
  • Resize a comment via the transformer, reload — scale persists (uniform, clamped).
  • Multi-user: rotation/scale/resolve/unresolve propagate via websocket.
  • No regression on: creating, replying, deleting from popover, drag-to-move, rubber-band multi-select.
## Summary Batch of six comment-related UX fixes addressing issues #36-#41. ## Related Issues - Closes https://forge.ourworld.tf/lhumina_code/hero_whiteboard/issues/36 — eraser deletes comments - Closes https://forge.ourworld.tf/lhumina_code/hero_whiteboard/issues/37 — properties panel for comments - Closes https://forge.ourworld.tf/lhumina_code/hero_whiteboard/issues/38 — un-resolve - Closes https://forge.ourworld.tf/lhumina_code/hero_whiteboard/issues/39 — right-click no longer opens popover - Closes https://forge.ourworld.tf/lhumina_code/hero_whiteboard/issues/40 — rotation persists - Closes https://forge.ourworld.tf/lhumina_code/hero_whiteboard/issues/41 — scale persists ## Changes ### Server - `crates/hero_whiteboard_server/src/migrations/005_comment_transform.sql` (new) — adds `rotation REAL NOT NULL DEFAULT 0` and `scale REAL NOT NULL DEFAULT 1` columns to `comments`. - `src/db/models.rs` — extend `Comment` with `rotation` and `scale`. - `src/db/queries.rs` — `create_comment`, `list_comments`, `update_comment` read/write both columns; `resolve_comment` renamed to `set_comment_resolved(conn, id, resolved, now)`. - `src/handlers/comment.rs` — `create` accepts optional `rotation`/`scale`; `update` accepts both (scale clamped to [0.2, 5.0]); `resolve` accepts `resolved: bool` (defaults to true — backwards compatible). - `openrpc.json` — `comment.create`, `comment.update`, `comment.resolve` documented with the new fields; `Comment` schema gains `rotation` + `scale`. ### Client - `static/web/js/whiteboard/comments.js` - `addCommentMarker` applies `comment.rotation` and `comment.scale` on load. - Click handler short-circuits on `e.evt.button !== 0` — right-click falls through. - `setResolved(id, bool)` helper powers `resolveComment` and new `unresolveComment`; popover renders Unresolve when `comment.resolved`. - New `onTransformEnd(group)` bakes uniform scale, clamps to [0.2, 5], persists `{x, y, rotation, scale}`, broadcasts via websocket. - `handleSyncMessage` applies incoming rotation/scale and handles `comment.unresolved`. - Exports `unresolveComment`, `onTransformEnd`, `getComments`. - `static/web/js/whiteboard/tools.js` - Transformer `transformend` routes comment markers to `WhiteboardComments.onTransformEnd`. - Eraser `eraseAtPosition` walks `.comment-marker` and deletes matches through `WhiteboardComments.deleteComment`. - `static/web/js/whiteboard/properties.js` - `show()` detects `node.hasName('comment-marker')` and renders a dedicated Comment pane (Position, Status, Text preview, Resolve/Unresolve + Delete). ## Test Results - `cargo check --workspace`: pass - `cargo clippy --workspace -- -D warnings`: pass - `cargo fmt --check`: pass No Rust unit tests exist for this code path; behavior needs manual verification in the browser. ## Manual verification - [ ] Eraser drag over a comment deletes it. - [ ] Selecting a comment shows the Comment pane; Resolve/Unresolve/Delete buttons work. - [ ] Resolved comment shows Unresolve in popover AND in properties pane; clicking flips state everywhere. - [ ] Right-click on a comment opens the canvas context menu only — not the popover. - [ ] Rotate a comment via the transformer, reload — rotation persists. - [ ] Resize a comment via the transformer, reload — scale persists (uniform, clamped). - [ ] Multi-user: rotation/scale/resolve/unresolve propagate via websocket. - [ ] No regression on: creating, replying, deleting from popover, drag-to-move, rubber-band multi-select.
fix(comments): eraser, properties pane, un-resolve, right-click, persistence
All checks were successful
CI / build (pull_request) Successful in 2m16s
c2e48f97db
Batch of six comment-related UX fixes:

- Eraser drag over a comment now deletes it (tools.js walks
  '.comment-marker' and routes to WhiteboardComments.deleteComment).
- Properties panel renders a comment pane with Resolve/Unresolve + Delete
  when a comment marker is selected (properties.js).
- Server comment.resolve takes an optional `resolved: bool` (defaults to
  true); client exposes unresolveComment and the popover/properties pane
  both render an Unresolve button when the comment is resolved.
- Right-click on a comment no longer opens the thread popover (click
  handler filters e.evt.button !== 0); the canvas context menu still
  fires normally.
- Comments now carry rotation and scale columns (migration 005),
  persisted through comment.update and comment.create, restored in
  addCommentMarker, and baked on transformer transformend via a new
  WhiteboardComments.onTransformEnd helper.

#36
#37
#38
#39
#40
#41
fix(comments): register migration 005 in the runtime migration list
All checks were successful
CI / build (pull_request) Successful in 2m8s
7d5994e840
The ALTER TABLE migration that adds rotation and scale columns was on
disk but missing from the Migrations::new vec in db/mod.rs, so it never
ran against existing databases and comment.create failed with
"table comments has no column named rotation".

#40
#41
fix(comments): properties pane polish + Delete key route
All checks were successful
CI / build (pull_request) Successful in 2m9s
84be2dad0e
Follow-ups on the batch comment PR:

- Comment properties Delete button now matches the generic objects'
  Delete styling (full-width danger-bordered button on its own row).
- Clicking Resolve/Unresolve in the properties pane re-renders the pane
  so the button flips to its counterpart without having to re-select.
- Deleting a comment now strips the marker from the transformer and
  hides the properties pane before destroying the Konva group, so no
  stale outline or empty-pane artifact is left behind.
- Delete key on a selected comment marker now routes through
  WhiteboardComments.deleteComment (previously it silently failed
  because comments aren't in the WhiteboardObjects store).

#37
#38
AhmedHanafy725 merged commit 29625fb912 into development 2026-04-21 15:28:40 +00:00
AhmedHanafy725 deleted branch development_comment_batch_fixes 2026-04-21 15:28:44 +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!42
No description provided.