Bug 343586

Summary: Crop Tool loses constant ratio after the handles touching canvas edges
Product: [Applications] krita Reporter: Tyson Tan <tysontanx>
Component: Tools/TransformAssignee: vanyossi <ghevan>
Status: RESOLVED FIXED    
Severity: normal CC: flat, freebox64, ghevan, halla, thinkinmonkey, victor.wahlstrom, wubz
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Crop Tool loses constant ratio after touching either edge of the canvas
I can confirm. The crop box doesn't respect the ratio when is dragged over the canvas edges. In my opinion, this behavior frustrates the point of having set a fixed ratio (video in attachment)

Description Tyson Tan 2015-01-30 19:49:44 UTC
Krita's Crop Tool has a checkbox to keep ratio constant. But after either side of the cropping area touching the edges of the canvas, continue to drag it outward will change the ratio anyway.

Reproducible: Always

Steps to Reproduce:
1. Create a new document;
2. Crop Tool;
3. Tool Options >> Check [Keep Ratio Constant], value 1.00;
4. Drag the handles so one side of the cropping area touches the edge of canvas;
5. Continue to drag outward.

Actual Results:  
The ratio changes even when Keep Ratio Constant is checked.

Expected Results:  
The ratio does not change. You cannot make the cropping area any larger after one side touches the edge of canvas. See GIMP for reference.

This bug was NOT triggered by the solutions of Bug 342842 , Bug 342844 and Bug 343287. It has been around for ages. I just forgot to report it every time. Sorry!
Comment 1 Tyson Tan 2015-01-30 19:55:33 UTC
Created attachment 90820 [details]
Crop Tool loses constant ratio after touching either edge of the canvas

In this screenshot I was dragging the Crop Tool from bottom-right to top-left. I continue to drag outward after the handles touching the left side of the canvas. You can see Keep Ratio was checked, value set to 1.00, but the Crop Area is definitely not square.
Comment 2 mvowada 2015-02-27 10:37:26 UTC
Created attachment 91316 [details]
I can confirm. The crop box doesn't respect the ratio when is dragged over the canvas edges. In my opinion, this behavior frustrates the point of having set a fixed ratio (video in attachment)
Comment 3 Victor Wåhlström 2015-06-28 17:29:25 UTC
What would the preferred behaviour be? Don't shrink the box and simply stop once it reaches the crop border, or shrink the box but respect aspect ratio?
Comment 4 mvowada 2015-06-28 20:34:13 UTC
(In reply to Victor Wåhlström from comment #3)
> What would the preferred behaviour be? Don't shrink the box and simply stop
> once it reaches the crop border, or shrink the box but respect aspect ratio?

Hello, personally I'd like it to be "Don't shrink the box and simply stop once it reaches the crop border".
Comment 5 Tyson Tan 2015-06-29 12:35:41 UTC
+1 for Comment 4
Comment 6 Tyson Tan 2015-06-29 12:41:38 UTC
Actually --

When "Grow" is unchecked:
Stop enlarging crop area once the moving side touches the edge of the canvas.

When "Grow" is checked:
Allow enlarging crop area in any case but always respect ratio.
Comment 7 Dmitry Kazakov 2016-01-24 12:40:10 UTC
*** Bug 333369 has been marked as a duplicate of this bug. ***
Comment 8 Halla Rempt 2019-10-04 07:30:26 UTC
Anyone who builds krita themselves, please test https://invent.kde.org/kde/krita/merge_requests/162
Comment 9 vanyossi 2019-10-04 16:50:38 UTC
Git commit 9b45d78661e01f54f5bd78ae2233407ee79d0ea3 by Ivan Yossi.
Committed on 04/10/2019 at 16:25.
Pushed by ivany into branch 'master'.

Fix Crop tool loosing aspect ratio on move

Previously there was no check for boundaries after the new
rect position is calculated. Before applying any offset on
move drag we check we no longer go ouside of the
image bounds. 

For aspect ratio we keep aspect ratio growing into the
image instead of outwards getting some weird behaviour

M  +22   -0    plugins/tools/tool_crop/kis_constrained_rect.cpp

https://invent.kde.org/kde/krita/commit/9b45d78661e01f54f5bd78ae2233407ee79d0ea3
Comment 10 Tyson Tan 2019-10-04 16:53:59 UTC
Thank you Vanyossi! :D
Comment 11 Halla Rempt 2019-10-09 08:40:58 UTC
Git commit 8d032ed4bd01eb2a28eaff42c78ec2d56e36b850 by Boudewijn Rempt, on behalf of Ivan Yossi.
Committed on 09/10/2019 at 08:40.
Pushed by rempt into branch 'krita/4.2'.

Fix Crop tool loosing aspect ratio on move

Previously there was no check for boundaries after the new
rect position is calculated. Before applying any offset on
move drag we check we no longer go ouside of the
image bounds. 

For aspect ratio we keep aspect ratio growing into the
image instead of outwards getting some weird behaviour
(cherry picked from commit 9b45d78661e01f54f5bd78ae2233407ee79d0ea3)

M  +22   -0    plugins/tools/tool_crop/kis_constrained_rect.cpp

https://invent.kde.org/kde/krita/commit/8d032ed4bd01eb2a28eaff42c78ec2d56e36b850
Comment 12 vanyossi 2019-10-23 18:23:24 UTC
*** Bug 413334 has been marked as a duplicate of this bug. ***