-
Notifications
You must be signed in to change notification settings - Fork 40
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 moving the crop rectangle possible, tweak accept/cancel behaviour #115
base: main
Are you sure you want to change the base?
Conversation
Re the accepting/caneling behaviour when clicking outside: I'm a bit conflicted. Pro your change:
Con:
So unless there are other art programs that have a different behaviour, I'm leaning towards keeping things as they are now. Now to the moving feature: That was definitely a case of "should be done someday" which ... hasn't been done yet, so thank for working on that! It works very well. Just a couple of remarks: The mouse pointer should change while hovering over the area where you can move. Off the top of my head:
While looking at Krita and Gimp for their behaviour, I noticed that Krita behaves exactly like you implemented it, i.e. to confirm the crop you double-click. But I find Gimp's behaviour pretty neat where you can confirm with a single click while also having the drag-to-move behaviour. This is probably do-able by moving the confirmation to the mouse realease event instead of the mouse press event, and checking for whether the mouse has moved between click and release to differentiate between a drag-to-move and a click-to-confirm action. Up to you if you want to look into that. Do you know anything about unit tests at all yet? This PR breaks some of the unit tests since it's changing existing behaviour, and also introduces new code that isn't corvered by tests. I'd be grateful if you looked into it yourself, though I'd add the unit tests myself otherwise. Let me know if you have any questions regarding tests. The revelant test files for your changes are tests/test_scene.py and tests/items/test_pixmapitem.py, and CONTRIBUTING.rst has instructions on how to run tests locally. Last but not least, you can add your changes to the CHANGELOG.rst file; the new move feature would go under the 'Added' section. Don't worry about the exact wording; I'll read over everything before doing a realease anyway. I've alread added your last PRs and credited you with your github handle, but feel free to change to whichever attribution you prefer. |
Just a heads up: I'll add/fix the tests and update the changelog when we have come to a conclusion about the behavior.
You are correct that both GIMP and Krita cancels when clicking outside. However in Krita (and with an option turned on in GIMP), cropping is a destructive operation. So if the user restarts the program or reloads the file, they will not be able to restore the cropped image. The cropping tool in GIMP and Krita is more of a canvas crop instead of a layer/image crop though. In Beeref data loss is not really an issue and it is trivial to grow/move/restore the crop after confirming. Of course Beeref is more of a billboard/mindmap program instead of a Image editing/creation program. So I don't think you should lean too hard into what other programs do. Instead you should look at what makes sense for Beeref specifically. (Of course this doesn't mean that you shouldn't take lessons from other applications, but it should also be a good solution for Beeref itself) In Beeref, I have more of a feeling that most workflows are oriented around organizing and positioning images quickly. With the "click outside to cancel" behavior I feel like this makes it more prone to force users to backtrack and redo their crop operation. With "click outside to confirm" they can be more lazy with where their mouse is and move their mouse onto the next image without having to think about pressing enter or putting the mouse inside of the crop triangle first and click to confirm. They can instead click to instantly select the next image, thus saving them a mouse click: recording.mp4
The reason why I did double click instead of single click is that I've had issues with deadzone margins in the past when doing this. The issue is two fold:
Those are my counter arguments. Do you think they are reasonable? Note that I'm happy to discuss this further, no rush :) |
I've though about it some more. Let's do as you proposed! |
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #115 +/- ##
==========================================
- Coverage 97.94% 97.79% -0.15%
==========================================
Files 33 33
Lines 4375 4407 +32
==========================================
+ Hits 4285 4310 +25
- Misses 90 97 +7 ☔ View full report in Codecov by Sentry. |
Awesome! Thank you so much! :) I've added more commits with the test and flake8 changes. |
I have purposely not yet updated the tests as I think there might be need for some discussion or tweaks on the changes as I'm changing the current default behavior.
While using Beeref myself, I found it very weird that clicking inside of the crop rectangle would confirm and not move the rectangle itself. This lead to a few miss clicks here and there where I would accept the change and have to go back into crop mode again. Granted, the main reason for this PR is to make it possible to move the crop rectangle as I usually want to nudge the whole thing around a bit after cropping.
To still be able to quickly confirm with minimal mouse movement, I made it so that if you double click on the crop rect, it will confirm.
While working on this I also realized that the behavior of canceling the crop action by clicking outside of the rectangle felt a bit weird as this is not what happens with the text object. Now it is in line with the text box editing workflow where clicking outside will confirm and only escape will undo your changes. This makes it less tedious as you don't lose your cropping work if you miss click outside of the rectangle.
To me all of these changes are for the better, but I realize that no everyone might feel that same way :)