Repository navigation
fix: undo and redo of a move put the objects back where they were - #215
Merged
Merged
Conversation
Undo set all the properties of the saved state of an object. A line has its points relative to its center, and the canvas takes them for the ones of the canvas when they are set, so a line went to the top left corner. Undo and redo now set the properties which the modification changed, and no others. A modification of a selection of many objects was not recorded, so undo removed the last object drawn. It is one action for all the objects now. The state an object goes back to is the one it has when the pointer is pressed on it. The snapshot of a rectangle with a label was the one of the press which drew it (the size of 0), as only the last object added was refreshed on release, so undo made the rectangle disappear, and its text box, which follows it, was left behind. The text box is recorded with it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Moving objects and then undoing did not undo the move: the objects disappeared. There were three separate causes.
x1,y1,x2,y2. A line stores these relative to its center, and the canvas reads them as canvas coordinates when they are set, so the line went to the top left corner (under the toolbar). Redo did the same.Changes
Files:
history/SketchHistory.ts,events.ts,RectangleLabel/RectangleLabelObject.ts,CHANGELOG.md, and the newhistory/modifications.spec.tsx(57 tests).Verification
yarn buildpass.Notes
SketchHistory.tsand adds a## 1.2.0heading toCHANGELOG.md, so the second of the two to merge needs a conflict resolution.