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.
This moves all the handling of temporary tools out of ScribbleArea and into ToolManager. There are also changes to the implementation and behavior that will make it more verstatile and able to handle weird corner cases better (ex. shortcuts while using temporary tools). There's too many changes to how the temporary tools work to list them all, but here is a list of the bigger changes that I can think of off the top of my head:
One thing that I'm not entirely happy about even after this PR is the handling of tool leaving. In this PR it calls
leavingThisTool
when changing the main tool, but not when changing the temporary tool. This is basically how the code is intended to work now (this actually wasn't doing anything because of an error). However I struggle with what the more desirable behavior is. Currently it is only relevant to the select tool, which allows you to temporarily use the move tool with a shortcut. When the temporary tool is done, should the transformation automatically be applied? It is when switch tools normally, but not when using it as a temporary tool. The select tool will apply a transformation before modifying a selection so it doesn't really cause any issues, and it could potentially help if a person switches to the move tool temporarily multiple times so it mostly makes sense for this. On the flip side the polyline tool also uses leavingThisTool now. I can't imagine a situation where you would want to stop using the polyline tool without applying or cancelling the current path (going from a polyline main tool to say a temporary hand tool would be a valid use, but the polyline tool is still considered in use in this case). There is no way to temporarily activate the polyline tool though so the temporary tool distinction doesn't matter for it currently.Fixes #1271.