Repository navigation
fix: onChange is called when the sketch changed (#80) - #204
Merged
Merged
Conversation
onChange was called 10 ms after every mouse up and mouse out, whether or not the drawing changed: a click which selects, a drag of the pan tool and a pointer which comes and goes all called it. The events manager now notes that an object was added, modified or removed since the mouse was pressed, and tells the application only then, once: the release which follows a mouse out in the middle of a drawing has nothing more to tell. undo, redo and the load of a value call onChange as before. The README no longer lists the limitation, nor the one of the arrow's undo steps, which #201 fixed.
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.
Summary
onChangewas called 10 ms after every mouse up and mouse out on the canvas, whether or not the drawing changed (issue #80). A click which only selects, a drag of the pan tool, and a pointer which comes and goes all called it.onChangeat the mouse out, and the release outside of the canvas has nothing more to tell.undo,redoand the load of a value callonChangeas before. The eraser, the laser pointer and the polygon tell the application themselves, as before. A pinch gesture still calls nothing.onChangerow, and the limitation of Add functions like onUpdate() or onChange() with old snapshots and newly added objects. #80 is removed. The limitation "Drawing an arrow records undo steps which have no visible effect" is removed too, as fix: an arrow is one undo step #201 fixed it. CHANGELOG: a line under Changed in 1.1.0. The type comment ofonChangefollows.Changes of behavior
An application which used
onChangeas "the mouse was released" now gets it only when the sketch changed. The objects it needs are inonObjectAdded,onObjectModifiedandonObjectRemoved, which are not changed.Checks
yarn format:check,yarn lint,yarn typecheckandyarn buildpass.yarn test: 434 passing and 1 todo. The new tests, theonChangeones inSketchField.spec.tsxandonChange.spec.tsx(with the mouse events of the browser: a drawing, the move of an object with the select tool, a click which selects, a drag in the empty part, a pointer which leaves, a mouse out in the middle of a drawing, a free stroke, the pan tool), fail without the change: 7 of them.Notes for review
Fixesline of the release PR (Release v1.1.0 #196), as closing keywords do not act on a merge intorelease/1.1.0.