mirror of https://github.com/GNOME/gimp.git
app: in GimpCurveView, snap to curve when holding Ctrl
In GimpCurveView, when holding down Ctrl while adding/dragging a point, snap the y-coordinate to the original curve (at the start of the drag). This is particularly useful for adding points along the curve, without changing their y-coordinate. Likewise, have the coordinate indicator show the snapped coordinate.
This commit is contained in:
parent
0b9737a3ed
commit
8357c9ad64
|
@ -243,6 +243,8 @@ gimp_curve_view_finalize (GObject *object)
|
|||
{
|
||||
GimpCurveView *view = GIMP_CURVE_VIEW (object);
|
||||
|
||||
g_clear_object (&view->orig_curve);
|
||||
|
||||
g_clear_object (&view->layout);
|
||||
g_clear_object (&view->cursor_layout);
|
||||
|
||||
|
@ -811,6 +813,8 @@ gimp_curve_view_button_press (GtkWidget *widget,
|
|||
|
||||
view->grabbed = TRUE;
|
||||
|
||||
view->orig_curve = GIMP_CURVE (gimp_data_duplicate (GIMP_DATA (curve)));
|
||||
|
||||
set_cursor (view, GDK_TCROSS);
|
||||
|
||||
switch (gimp_curve_get_curve_type (curve))
|
||||
|
@ -852,6 +856,9 @@ gimp_curve_view_button_press (GtkWidget *widget,
|
|||
}
|
||||
else
|
||||
{
|
||||
if (bevent->state & gimp_get_constrain_behavior_mask ())
|
||||
y = 1.0 - gimp_curve_map_value (view->orig_curve, x);
|
||||
|
||||
gimp_curve_set_point (curve, view->selected, x, 1.0 - y);
|
||||
}
|
||||
break;
|
||||
|
@ -879,6 +886,8 @@ gimp_curve_view_button_release (GtkWidget *widget,
|
|||
if (bevent->button != 1)
|
||||
return TRUE;
|
||||
|
||||
g_clear_object (&view->orig_curve);
|
||||
|
||||
view->offset_x = 0.0;
|
||||
view->offset_y = 0.0;
|
||||
|
||||
|
@ -942,12 +951,18 @@ gimp_curve_view_motion_notify (GtkWidget *widget,
|
|||
else
|
||||
{
|
||||
new_cursor = GDK_TCROSS;
|
||||
|
||||
if (mevent->state & gimp_get_constrain_behavior_mask ())
|
||||
y = 1.0 - gimp_curve_map_value (view->curve, x);
|
||||
}
|
||||
}
|
||||
else /* Else, drag the grabbed point */
|
||||
{
|
||||
new_cursor = GDK_TCROSS;
|
||||
|
||||
if (mevent->state & gimp_get_constrain_behavior_mask ())
|
||||
y = 1.0 - gimp_curve_map_value (view->orig_curve, x);
|
||||
|
||||
gimp_data_freeze (GIMP_DATA (curve));
|
||||
|
||||
gimp_curve_set_point (curve, view->selected, -1.0, -1.0);
|
||||
|
|
|
@ -55,6 +55,7 @@ struct _GimpCurveView
|
|||
gdouble leftmost;
|
||||
gdouble rightmost;
|
||||
gboolean grabbed;
|
||||
GimpCurve *orig_curve;
|
||||
|
||||
GdkCursorType cursor_type;
|
||||
|
||||
|
|
Loading…
Reference in New Issue