After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 753408 - Dragging crop region from top right or top left does not keep aspect ratio if going out of image bounds
Dragging crop region from top right or top left does not keep aspect ratio if...
Status: RESOLVED OBSOLETE
Product: shotwell
Classification: Other
Component: ux
0.22.x
Other Linux
: Normal normal
: ---
Assigned To: Shotwell Maintainers
Shotwell Maintainers
: 780798 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2015-08-09 14:16 UTC by Iñaki García Etxebarria
Modified: 2021-05-19 14:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
2x3 crop region (1.04 MB, image/png)
2015-08-09 14:16 UTC, Iñaki García Etxebarria
Details
2x3 crop region resized (1.10 MB, image/png)
2015-08-09 14:16 UTC, Iñaki García Etxebarria
Details

Description Iñaki García Etxebarria 2015-08-09 14:16:12 UTC
Created attachment 308975 [details]
2x3 crop region

Assume that you start a crop operation on an image, with a fixed aspect ratio for the crop. (First attached image.)

Now resize the crop region by dragging the top left or top right corners, in such a way that the crop region dimensions exceed the page size. In this case the crop region no longer keeps the original aspect ratio. (Second attached image.)

The culprit is the following code in src/editing_tools/EditingTools.vala:

            case BoxLocation.TOP_LEFT:
                if (get_constraint_aspect_ratio() == ANY_ASPECT_RATIO) {
                    top = y;
                    left = x;
                } else {
                    if (y < eval_radial_line(center_x, center_y, left, top, x)) {
                        top = y;
                        float new_width = ((float) (bottom - top)) * get_constraint_aspect_ratio();
                        left = right - ((int) new_width);
                    } else {
                        left = x;
                        float new_height = ((float) (right - left)) / get_constraint_aspect_ratio();
                        top = bottom - ((int) new_height);
                    }
                }
            break;

and

            case BoxLocation.TOP_RIGHT:
                if (get_constraint_aspect_ratio() == ANY_ASPECT_RATIO) {
                    top = y;
                    right = x;
                } else {
                    if (y < eval_radial_line(center_x, center_y, right, top, x)) {
                        top = y;
                        float new_width = ((float) (bottom - top)) * get_constraint_aspect_ratio();
                        right = left + ((int) new_width);
                    } else {
                        right = x;
                        float new_height = ((float) (right - left)) / get_constraint_aspect_ratio();
                        top = bottom - ((int) new_height);
                    }
                }
            break;

In both cases the condition is switched, it should be if (y >= eval_radial_line(...)).

Resizing from any other edge of the crop box keeps the aspect ratio as it should.
Comment 1 Iñaki García Etxebarria 2015-08-09 14:16:56 UTC
Created attachment 308976 [details]
2x3 crop region resized
Comment 2 Jens Georg 2016-04-23 19:09:47 UTC
There is also some odd flickering going on when going outside the image
Comment 3 Jens Georg 2017-04-02 16:36:44 UTC
*** Bug 780798 has been marked as a duplicate of this bug. ***
Comment 4 GNOME Infrastructure Team 2021-05-19 14:44:25 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/shotwell/-/issues/4649.