From 98c1a5967664c6c51c4f591e700364c25c7da5e7 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Thu, 1 Nov 2007 23:54:29 +0000 Subject: fix bug [ 1824359 ] Gradient isn't snapping with ctrl pressed (bzr r4011) --- src/gradient-drag.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'src/gradient-drag.cpp') diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp index 5d74b561e..ff15e8b8e 100644 --- a/src/gradient-drag.cpp +++ b/src/gradient-drag.cpp @@ -641,7 +641,6 @@ gr_knot_moved_handler(SPKnot *knot, NR::Point const *ppointer, guint state, gpoi continue; if (d_new->isA (draggable->item, draggable->point_type == POINT_LG_BEGIN? POINT_LG_END : POINT_LG_BEGIN, - draggable->point_i, draggable->fill_or_stroke)) { // found the other end of the linear gradient; if (state & GDK_SHIFT_MASK) { @@ -661,7 +660,6 @@ gr_knot_moved_handler(SPKnot *knot, NR::Point const *ppointer, guint state, gpoi continue; if (d_new->isA (draggable->item, POINT_RG_CENTER, - draggable->point_i, draggable->fill_or_stroke)) { // found the center of the radial gradient; dr_snap = &(d_new->point); @@ -1025,7 +1023,7 @@ GrDragger::isA (gint point_type) } /** -Checks if the dragger has a draggable with this item, point_type, fill_or_stroke +Checks if the dragger has a draggable with this item, point_type + point_i (number), fill_or_stroke */ bool GrDragger::isA (SPItem *item, gint point_type, gint point_i, bool fill_or_stroke) @@ -1039,6 +1037,21 @@ GrDragger::isA (SPItem *item, gint point_type, gint point_i, bool fill_or_stroke return false; } +/** +Checks if the dragger has a draggable with this item, point_type, fill_or_stroke + */ +bool +GrDragger::isA (SPItem *item, gint point_type, bool fill_or_stroke) +{ + for (GSList const* i = this->draggables; i != NULL; i = i->next) { + GrDraggable *draggable = (GrDraggable *) i->data; + if ( (draggable->point_type == point_type) && (draggable->item == item) && (draggable->fill_or_stroke == fill_or_stroke) ) { + return true; + } + } + return false; +} + bool GrDraggable::mayMerge (GrDraggable *da2) { -- cgit v1.2.3