From 0fc8a61d6b4fbc852a6947ac8445705dd9dfd768 Mon Sep 17 00:00:00 2001 From: dvlierop2 Date: Wed, 21 Nov 2007 19:23:55 +0000 Subject: [PATCH] Also consider path nodes for snapping --- src/selection.cpp | 9 +-------- src/seltrans.cpp | 9 ++++----- src/sp-item-group.cpp | 4 +--- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/selection.cpp b/src/selection.cpp index e4c628d9e..68a9a2cd9 100644 --- a/src/selection.cpp +++ b/src/selection.cpp @@ -369,20 +369,13 @@ 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(bool includeItemCenter) const { GSList const *items = const_cast(this)->itemList(); std::vector p; for (GSList const *iter = items; iter != NULL; iter = iter->next) { - // 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, false, SnapPointsIter(p)); - } + sp_item_snappoints(this_item, false, SnapPointsIter(p)); //Include the transformation origin for snapping //For a group only the group's origin is considered if (includeItemCenter) { diff --git a/src/seltrans.cpp b/src/seltrans.cpp index 512d2c0ca..785cf7d60 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -259,18 +259,17 @@ void Inkscape::SelTrans::grab(NR::Point const &p, gdouble x, gdouble y, bool sho _point = p; - // The selector tool should snap the bbox and the special snappoints, but not path nodes + // The selector tool should snap the bbox, special snappoints, and path nodes // (The special points are the handles, center, rotation axis, font baseline, ends of spiral, etc.) // First, determine the bounding box for snapping ... _bbox = selection->bounds(_snap_bbox_type); _approximate_bbox = selection->bounds(SPItem::APPROXIMATE_BBOX); // Used for correctly scaling the strokewidth - - // Next, get all special points for snapping + // Next, get all points to consider for snapping SnapManager const &m = _desktop->namedview->snap_manager; - _snap_points = selection->getSnapPoints(m.getIncludeItemCenter()); // Excludes path nodes - std::vector snap_points_hull = selection->getSnapPointsConvexHull(); // Includes path nodes + _snap_points = selection->getSnapPoints(m.getIncludeItemCenter()); + std::vector snap_points_hull = selection->getSnapPointsConvexHull(); if (_snap_points.size() > 100) { /* Snapping a huge number of nodes will take way too long, so limit the number of snappable nodes An average user would rarely ever try to snap such a large number of nodes anyway, because diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index f1035e9ee..cabc7b26a 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -298,9 +298,7 @@ static void sp_group_snappoints (SPItem const *item, SnapPointsIter p) o != NULL; o = SP_OBJECT_NEXT(o)) { - 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. + if (SP_IS_ITEM(o)) { sp_item_snappoints(SP_ITEM(o), false, p); } } -- 2.30.2