Skip to content

feat: notes are visible under every tool, editable in a panel, and undoable - #77

Merged
IAmJSD merged 1 commit into
mainfrom
t3code/clarify-note-tool-behavior
Aug 30, 2026
Merged

IAmJSD merged 1 commit into
mainfrom
t3code/clarify-note-tool-behavior

Conversation

@IAmJSD

@IAmJSD IAmJSD commented Aug 30, 2026

Copy link
Copy Markdown
Member

The Note tool placed a marker and little else. A note left on a document vanished the moment anyone picked up a brush, the text it carried was set once to "Note 3" and shown nowhere, and none of it reached the history — so ⌘Z stepped straight past a misplaced note to whatever was edited before it.

  • Markers belong to the document, not the tool. They were drawn from PointTool::overlays, which the canvas only calls for the active tool, so notes were on screen exactly while the Note tool was held — indistinguishable from having been deleted. They now come from the shell, through a shared schist_tools_doc::note_overlays, beside the carve-out at workspace.rs that already keeps a pen path visible across a tool switch. View ▸ Notes hides them deliberately (Photoshop's Show ▸ Notes), and ⌘H with the rest of the extras.
  • A Notes panel, in the side column: author, ‹ n / m › navigation, a trash button, and a click-to-edit multi-line body. Note.text and Note.author had no reader anywhere in the app before this; the only note-related menu item was Clear Notes. New notes arrive empty and selected rather than holding a placeholder nothing could edit.
  • EditOp::NotesSet and EditBuilder::change_notes. tools-doc was the one tool plugin that never touched the history. Place, move, edit, delete and Clear Notes are entries now; a drag is one entry for the whole gesture, and a click that only selects a note to read it is none at all. This is the path Document::mark_dirty's comment already anticipated — "when they get their own EditOp the call here becomes redundant rather than wrong" — so that comment is updated rather than left describing the old state.
  • Options bar parity: an Author field defaulting to $USER and persisted as a preference (a reviewer types their name once, not once per note), a colour swatch through the existing picker via ColorTarget::Note, and Clear All. Colour is per-note, so several reviewers stay apart on one document. Markers are sized in screen pixels, so a note stays findable at 5% and clickable at 1600%; overlapping ones are hit topmost-first.

Two fixes fall out of moving notes off the pixel path. Note edits no longer report canvas damage — a note is an overlay, and damage invalidates cached composited tiles, so every marker nudge was recompositing the whole document. And the note tool no longer trips tool_has_overlay, which drives the 8fps marching-ants ticker; static markers have nothing to march.

Selection is an index into Document::notes, which undo, delete, Clear Notes and switching to a document with fewer of them all leave dangling — Workspace::active_note is the single place that resolves it, so the panel and the canvas outline cannot disagree.

Six new tests in plugins/tools-doc/tests/doc_tools.rs cover undo/redo of place, move and delete; one entry per drag and none per bare click; author, colour and empty text on a new note; selection following a delete; topmost hit order; and marker generation.

Verified in the app (headless X, fixture PNG): placing two notes, typing into one, switching to the brush with both markers still drawn and the panel still showing the text, two ⌘Z stepping back through Edit Note and Place Note, and View ▸ Notes hiding the markers.

Out of scope, both called out in the code: counts share PointTool and stay outside the history, and notes still do not round-trip to PSD. Photoshop keeps annotations in an image resource, and I would be guessing at that format; today's behaviour is unchanged, so annotations in an opened PSD survive a re-save as preserved opaque resources but are not shown, and notes made here are not written.

🤖 Generated with Claude Code

…doable

The Note tool placed a marker and little else. Notes were drawn from
`PointTool::overlays`, so they existed only while that tool was held; the
text a note carried was set once to "Note 3" and never shown anywhere;
and none of it went through the history.

- Markers are the shell's now, not the tool's, drawn from the shared
  `schist_tools_doc::note_overlays` beside the carve-out that already
  keeps pen paths visible across a tool switch. View ▸ Notes hides them
  deliberately, and ⌘H with the rest of the extras.
- A Notes panel in the side column: author, ‹ n / m › navigation, delete,
  and a click-to-edit multi-line body. New notes arrive empty and
  selected rather than holding a placeholder nothing could reach.
- `EditOp::NotesSet` and `EditBuilder::change_notes`. Place, move, edit,
  delete and Clear Notes are all history entries; a drag is one entry for
  the gesture and a click that only selects is none. This is the path
  `Document::mark_dirty`'s comment already anticipated, so that comment
  is updated rather than left describing the old state.
- Options bar parity: an Author field defaulting to `$USER` and persisted
  as a preference, a colour swatch through the existing picker, and Clear
  All. Colour is per-note, so several reviewers stay apart on one
  document. Markers are sized in screen pixels, so a note stays clickable
  at any zoom; overlapping ones are hit topmost-first.

Two fixes fall out of moving notes off the pixel path: note edits no
longer report canvas damage, which was invalidating every composited tile
each time a marker was nudged, and the note tool no longer trips
`tool_has_overlay`, which was running the 8fps marching-ants ticker for
markers that do not march.

Counts share `PointTool` and stay outside the history, and notes still do
not round-trip to PSD.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@IAmJSD
IAmJSD merged commit ad1966f into main Aug 30, 2026
3 checks passed
@IAmJSD
IAmJSD deleted the t3code/clarify-note-tool-behavior branch August 30, 2026 02:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant