From e00ac80a336aaafb2aa544b72e949351fe78456a Mon Sep 17 00:00:00 2001 From: John Smith Date: Sun, 1 Apr 2012 10:59:30 +0900 Subject: Fix for 627728 : Make newly added gradient stop active (bzr r11135) --- src/gradient-drag.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/gradient-drag.cpp') diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp index 5ff0e23e2..12ecd467c 100644 --- a/src/gradient-drag.cpp +++ b/src/gradient-drag.cpp @@ -414,6 +414,12 @@ SPStop *GrDrag::addStopNearPoint(SPItem *item, Geom::Point mouse_p, double toler gradient->ensureVector(); updateDraggers(); + // so that it does not automatically update draggers in idle loop, as this would deselect + local_change = true; + + // select the newly created stop + selectByStop(newstop); + return newstop; } @@ -1469,7 +1475,27 @@ void GrDrag::selectByCoords(std::vector coords) } } +/** + * Select draggers by stop + */ +void GrDrag::selectByStop(SPStop *stop ) +{ + for (GList *i = this->draggers; i != NULL; i = i->next) { + + GrDragger *dragger = (GrDragger *) i->data; + for (GSList const* j = dragger->draggables; j != NULL; j = j->next) { + GrDraggable *d = (GrDraggable *) j->data; + SPGradient *gradient = sp_item_gradient(d->item, d->fill_or_stroke); + SPGradient *vector = sp_gradient_get_forked_vector_if_necessary(gradient, false); + SPStop *stop_i = sp_get_stop_i(vector, d->point_i); + + if (stop_i == stop) { + setSelected(dragger, true, true); + } + } + } +} /** * Select all stops/draggers that fall within the rect. */ -- cgit v1.2.3