-
-
Notifications
You must be signed in to change notification settings - Fork 385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make the Fill tool's fill click operation cancellable #1666
Make the Fill tool's fill click operation cancellable #1666
Conversation
cdc7ea4
to
0d70103
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a few bugs I found:
-
If I click and drag outside the shape then release, I get stuck in the mousedown state (notice the hints bar) and neither left clicking nor right clicking nor Escape outside the shape fix the stuck state (I have to left click to apply, or right click to abort, inside the shape)
-
If I hold down the left mouse button, then hit CtrlZ, then abort with Rmb, this causes it to go back to a previous history step (it undoes the creation of a layer I made immediately before this, for example).
If this is true for all the abortable/cancellable tools you've worked on, let's skip fixing it in this specific PR.
3053c3a
to
29ba860
Compare
The CTRL+Z+ESC/RMB will probably be true for all tools but I will look into an easy hotfix (before the whole transaction system is refactored so that it doesn't rely on undos). As for the other behavior I will check and see what I can do to fix it. |
I noticed a new TODO (or maybe old?) i.e. // TODO: Use a match statement here instead of if-else In that given case i think it's preferable to keep it as an if-else rather than match, because of the fact that match would just add another arm and I think that down the line it might lead to uncaught issues. |
As suspected this is something that is affecting all tools that either call Undo or AbortTransaction. (Not just the tool I worked on) I was hoping for a quick hotfix through a "hack" in
|
Ok, thanks for investigating. Can you move your findings about the undo bug to another issue which can be home for that future PR? The to-do I added is a suggestion to better model the invariants. Else doesn't imply filling with the secondary color. If there's something other than filling with primary or secondary color, it'll still enter the else arm. A match statement better models the problem and is this cleaner. |
Hmm good point didn't think about that. As of the PR it's already done (with an issue) |
!build |
|
This is the last tool that needed a cancellable transaction.
It is implemented in a way that it introduces a "Fake drag" the reason for this is simple, emitting
DocumentMessage::AbortTransaction
currently works as an undo step. Thus if the user would not perform an operation before trying to cancel the transaction it would result in undoing his current history.This could and should be reimplemented once a Document can be in different states such as "Transaction In Progress"
Closes #1657