From: johanengelen Date: Thu, 1 Nov 2007 23:54:29 +0000 (+0000) Subject: fix bug [ 1824359 ] Gradient isn't snapping with ctrl pressed X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a45fd54bff019fff6991b5c964fc43c2f3098cda;p=inkscape.git fix bug [ 1824359 ] Gradient isn't snapping with ctrl pressed --- 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) { diff --git a/src/gradient-drag.h b/src/gradient-drag.h index 2e547b183..06859c24b 100644 --- a/src/gradient-drag.h +++ b/src/gradient-drag.h @@ -92,8 +92,9 @@ struct GrDragger { bool mayMerge (GrDragger *other); bool mayMerge (GrDraggable *da2); - bool isA (gint point_type); - bool isA (SPItem *item, gint point_type, gint point_i, bool fill_or_stroke); + bool isA (gint point_type); + bool isA (SPItem *item, gint point_type, bool fill_or_stroke); + bool isA (SPItem *item, gint point_type, gint point_i, bool fill_or_stroke); void fireDraggables (bool write_repr, bool scale_radial = false, bool merging_focus = false); };