[gimp] 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] tools: Rectangle select. Incorrect center_xy after converting channel selection to rectangle
- Date: Wed, 24 Feb 2021 18:04:36 +0000 (UTC)
commit 695942660316347a5f1546da1c32bcce6fed2c56
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
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 e55f6d6c76..1c39e37b90 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,
@@ -1058,6 +1060,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") &&
@@ -1546,8 +1550,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);
@@ -1824,8 +1827,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);
@@ -2189,8 +2191,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);
@@ -3858,6 +3859,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]