SG-41210: Add a per user undo-redo stack to Annotate Mode #1016
+558
−153
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SG-41210: Add a per user undo-redo stack to Annotate Mode
Summarize your change.
The undo, redo and clear actions in the Annotate Mode were refactored. A new undo property was added so that bringing back cleared annotations would be done through an
undoaction instead ofredo. Both the undo and redo properties were made per user via the username and process id values. AnundoClearAllFramesand aredoClearAllFramesproperties were also created to managed clearing annotations on the timeline. This action is special because in a context of multiple annotators, clearing can be done by anyone on any frames and specifically undone by the user who made the action. Basic undo and redo actions are per frame. However, undoing and redoing a clear of all the annotations on the timeline can be done on any frame.The undo, redo and clear button states were also updated to match this new implementation of the Annotate Mode. If the draw mode is
_Select(i.e. the cursor), all three buttons are disabled since the Annotate mode is not actually active anymore and the states were not updated in that case. Undoing, redoing and clearing annotations can only be done if a real drawing mode (e.g. pen or text) is selected to avoid issues with the buttons not being updated.This implementation is following this design:
Draw a paint stroke
Clear all on a frame
- Clear all frames on the timeline
Undo
Redo
Describe the reason for the change.
Some changes were needed to match the new product requirements around undo, redo and clear actions. This changes were mainly needed to handle multiple annotators simultaneously in a Live Review session.
Describe what you have tested and on which operating system.
Basic operations of drawing, undoing, redoing, clearing a frame, and clearing the timeline were tested on macOS 15.6.1