-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Stamp Brush right-click cut when Shift is held #3963
Conversation
Implementing this required a refactor of the state system in StampBrush. Behavior and State were previously handled in the same property, which resulted both in wrong behavior when using capture and pressing the behavior keys (replicate by holding right click, start holding shift, release right click, the behavior wasn't set to line as it should have). This commit refactors this system by splitting State and Behavior in two enums and two properties, resulting in making the implemented feature possible, fixing behavior bugs, and future-proofing this system for expansion. Implements mapeditor#3961
Thank you so much for the nice idea and for the contribution! It works great, though I have a few concerns:
Indeed it looks like there is less code duplication with the enum split up. The issue was still there though. Due to I don't really like the code duplication of the erasing code in Also, I wonder if we really need the "cut" state to be set when you start capturing? The code would be rather simpler if we'd just take Shift state at the end of the capture. Finally, there is a |
I think this would also be more intuitive for the user. |
Thank you for making Tiled!
To be completely honest I'm not sure how to make this change properly, I'd need to get more familiar with this part of the codebase. I'll take a glance at it but I'll probably focus on the other bulletpoints tonight.
I don't think it's necessary either. I'll make the change, if you decide you want to keep the state afterwise I'll let you reverse the commit.
I didn't consider it, no. My bad. I'll take a look and try to make it behave consistently. |
Simplifies StampBrush's behavior state machine and allows capture parity for AbstractTileFillTool.
Now the same erase tile layers implementation is used by CaptureStampHelper::endCapture and Eraser::doErase. Unfortunately, another implementation remains at MapDocumentActionHandler::delete_, which is more difficult to share because it can also delete objects.
Everything seems to work properly, although I noticed than cutting no tile an empty area (or deleting it with the Eraser tool for all that matter) now creates a Cut history entry that does nothing. I'm not sure if this is intended behavior or not? |
As discussed on Discord, it might be better to avoid the needless history entry, but this is the existing behavior so we'll merge this PR as-is. Thanks again! |
Implements #3961
Implementing this required a refactor of the state system in StampBrush. Behavior and State were previously handled in the same property, which resulted both in wrong behavior when using capture and pressing the behavior keys (replicate by holding right click, start holding shift, release right click, the behavior wasn't set to line as it should have). This commit refactors this system by splitting State and Behavior in two enums and two properties, resulting in making the implemented feature possible, fixing behavior bugs, and future-proofing this system for expansion.