`cancel()` inside `undoable()` action callback caused it to navigate history,
and it would navigate all the way to the start of the last pointer gesture because
`history_node_to_cancel_to` was only set on pointerdown, not taking into account non-pointer-gesture operations.
The point was to allow undoing Fill With Color when canceling, but with the old definition of `history_node_to_cancel_to` it would have needed to be set in scattered places.
Now I'm defining it where it can be null, and if it's null, canceling should just go back to the history node at the start of `cancel()` (after making history nodes if applicable by telling tools to finish).
For instance if you cancel a brush stroke and then cancel another, and redo, it'll now go to the newer brush stroke.
It doesn't just go to the latest tho, if you jump to the first canceled brush stroke in the history tree,
undo and redo and you'll stay with the older brush stroke, staying on that branch of the tree.
For instance, in the sequence Select, Move Selection, Deselect, go back to Move Selection, move it more,
previously the changes got merged into the existing Move Selection.
Now a second Move Selection is created branching off of the first.
- Fixes undoing past Text tool, where otherwise it would trap Ctrl+Z for the textbox
- To access these undoables, you have to use the Document History window
- When holding down Ctrl+Z or Ctrl+Shift+Z, it will now save only once or twice (at the end and usually the begining), instead of saving/syncing constantly, causing it to lag and not even show what's going on
- This fixes a situation where redo-after-cancel wouldn't work:
User cancels operation
(in cancel():) op finalized, creating undoable -> sync to DB
(in cancel():) cancel goes back to history node at start of cancel -> sync to DB
DB syncs first update -> undoable("Session Sync")
DB syncs second update -> undoable("Session Sync")
The history ends on "Session Sync", on a branch separate from the canceled operation.
- Conditionally create an undoable for Deselect in case there's a Session Sync update in between selecting and deselecting (in Multi-User mode), and otherwise modify the undoable for Select/Free-Form Select
- Multi-User: Don't sync to the database CONSTANTLY while smearing a selection! (I should still add debouncing!)