[gimp/gimp-2-10] tools: Rectangle select. Incorrect center_xy after converting channel selection to rectangle
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] tools: Rectangle select. Incorrect center_xy after converting channel selection to rectangle
- Date: Wed, 24 Feb 2021 18:05:55 +0000 (UTC)
commit f63086bd5ae12a60301c749f5fdacda9afeee705
Author: Stanislav Grinkov <43956-stanislavgrinkov users noreply gitlab gnome org>
Date: Wed Feb 24 20:57:09 2021 +0600
tools: Rectangle select. Incorrect center_xy after converting channel selection to rectangle
Was caused by widget tool fixed_center_x and fixed_center_y coordinates set to
coordinates of mouse click instead of rectangle center after converting channel
selection bbox to rectangle.
Now rectangle fixed_center_x and fixed_center_y coordinates are always updated
when tool widget x1, x2, y1, or y2 coordinates are updated.
Closes #6487
(cherry picked from commit 695942660316347a5f1546da1c32bcce6fed2c56)
app/display/gimptoolrectangle.c | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
---
diff --git a/app/display/gimptoolrectangle.c b/app/display/gimptoolrectangle.c
index c1192db11a..5b5a3a7996 100644
--- a/app/display/gimptoolrectangle.c
+++ b/app/display/gimptoolrectangle.c
@@ -431,6 +431,8 @@ static void gimp_tool_rectangle_adjust_coord (GimpToolRectangle *rect
gdouble coord_y_input,
gdouble *coord_x_output,
gdouble *coord_y_output);
+static void gimp_tool_rectangle_recalculate_center_xy
+ (GimpToolRectangle *rectangle);
G_DEFINE_TYPE_WITH_PRIVATE (GimpToolRectangle, gimp_tool_rectangle,
@@ -1059,6 +1061,8 @@ gimp_tool_rectangle_notify (GObject *object,
{
gimp_tool_rectangle_update_int_rect (rectangle);
+ gimp_tool_rectangle_recalculate_center_xy (rectangle);
+
gimp_tool_rectangle_update_options (rectangle);
}
else if (! strcmp (pspec->name, "x") &&
@@ -1547,8 +1551,7 @@ gimp_tool_rectangle_button_release (GimpToolWidget *widget,
}
/* We must update this. */
- private->center_x_on_fixed_center = (private->x1 + private->x2) / 2;
- private->center_y_on_fixed_center = (private->y1 + private->y2) / 2;
+ gimp_tool_rectangle_recalculate_center_xy (rectangle);
gimp_tool_rectangle_update_options (rectangle);
@@ -1825,8 +1828,7 @@ gimp_tool_rectangle_key_press (GimpToolWidget *widget,
gimp_tool_rectangle_update_with_coord (rectangle, new_x, new_y);
- private->center_x_on_fixed_center = (private->x1 + private->x2) / 2;
- private->center_y_on_fixed_center = (private->y1 + private->y2) / 2;
+ gimp_tool_rectangle_recalculate_center_xy (rectangle);
gimp_tool_rectangle_update_options (rectangle);
@@ -2190,8 +2192,7 @@ gimp_tool_rectangle_synthesize_motion (GimpToolRectangle *rectangle,
gimp_tool_rectangle_update_with_coord (rectangle, new_x, new_y);
/* We must update this. */
- private->center_x_on_fixed_center = (private->x1 + private->x2) / 2;
- private->center_y_on_fixed_center = (private->y1 + private->y2) / 2;
+ gimp_tool_rectangle_recalculate_center_xy (rectangle);
gimp_tool_rectangle_update_options (rectangle);
@@ -3847,6 +3848,15 @@ gimp_tool_rectangle_adjust_coord (GimpToolRectangle *rectangle,
}
}
+static void
+gimp_tool_rectangle_recalculate_center_xy (GimpToolRectangle *rectangle)
+{
+ GimpToolRectanglePrivate *private = rectangle->private;
+
+ private->center_x_on_fixed_center = (private->x1 + private->x2) / 2;
+ private->center_y_on_fixed_center = (private->y1 + private->y2) / 2;
+}
+
/* public functions */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]