From bc76fd7de93d0c4d8fac872142312a61c0207f3c Mon Sep 17 00:00:00 2001 From: dvlierop2 Date: Mon, 26 Mar 2007 22:29:17 +0000 Subject: [PATCH] Selector tool shouldn't snap to path nodes, see Bulia's comment in bug #1589436 --- src/selection.cpp | 11 ++++++++++- src/selection.h | 2 +- src/sp-item-group.cpp | 7 +++++-- src/sp-shape.cpp | 8 ++++---- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/selection.cpp b/src/selection.cpp index 201661eec..05bd8d030 100644 --- a/src/selection.cpp +++ b/src/selection.cpp @@ -27,6 +27,7 @@ #include "xml/repr.h" #include "sp-shape.h" +#include "sp-path.h" #include @@ -367,12 +368,20 @@ NR::Maybe Selection::center() const { /** * Compute the list of points in the selection that are to be considered for snapping. + * This includes all special points of each item in the selection, except path nodes */ std::vector Selection::getSnapPoints() const { GSList const *items = const_cast(this)->itemList(); std::vector p; for (GSList const *iter = items; iter != NULL; iter = iter->next) { - sp_item_snappoints(SP_ITEM(iter->data), SnapPointsIter(p)); + // getSnapPoints() is only being used in the selector tool, which should + // not snap path nodes. Only the node tool should snap those. + SPItem *this_item = SP_ITEM(iter->data); + if (!SP_IS_PATH(this_item)) { + // Only snap if we don't have a path at hand + // (Same check occurs in sp-item-group) + sp_item_snappoints(this_item, SnapPointsIter(p)); + } } return p; diff --git a/src/selection.h b/src/selection.h index f9368f5ee..34de82c7c 100644 --- a/src/selection.h +++ b/src/selection.h @@ -71,7 +71,7 @@ public: ~Selection(); /** - * @brief Returns the desktop the seoection is bound to + * @brief Returns the desktop the selection is bound to * * @return the desktop the selection is bound to */ diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index d4fa9536d..f43f4ded9 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -34,6 +34,7 @@ #include "prefs-utils.h" #include "sp-clippath.h" #include "sp-mask.h" +#include "sp-path.h" static void sp_group_class_init (SPGroupClass *klass); static void sp_group_init (SPGroup *group); @@ -297,8 +298,10 @@ static void sp_group_snappoints (SPItem const *item, SnapPointsIter p) o != NULL; o = SP_OBJECT_NEXT(o)) { - if (SP_IS_ITEM(o)) { - sp_item_snappoints(SP_ITEM(o), p); + if (SP_IS_ITEM(o) && !SP_IS_PATH(o)) { + // getSnapPoints() and sp_group_snappoints are only being used in the selector tool, + // which should not snap path nodes. Only the node tool should snap those. + sp_item_snappoints(SP_ITEM(o), p); } } } diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp index cfeee3a29..453de5650 100644 --- a/src/sp-shape.cpp +++ b/src/sp-shape.cpp @@ -88,19 +88,19 @@ sp_shape_get_type (void) static void sp_shape_class_init (SPShapeClass *klass) { - GObjectClass *gobject_class; + GObjectClass *gobject_class; SPObjectClass *sp_object_class; SPItemClass * item_class; SPPathClass * path_class; - gobject_class = (GObjectClass *) klass; + gobject_class = (GObjectClass *) klass; sp_object_class = (SPObjectClass *) klass; item_class = (SPItemClass *) klass; path_class = (SPPathClass *) klass; parent_class = (SPItemClass *)g_type_class_peek_parent (klass); - gobject_class->finalize = sp_shape_finalize; + gobject_class->finalize = sp_shape_finalize; sp_object_class->build = sp_shape_build; sp_object_class->release = sp_shape_release; @@ -111,7 +111,7 @@ sp_shape_class_init (SPShapeClass *klass) item_class->print = sp_shape_print; item_class->show = sp_shape_show; item_class->hide = sp_shape_hide; - item_class->snappoints = sp_shape_snappoints; + item_class->snappoints = sp_shape_snappoints; } /** -- 2.30.2