From 6e91f64f6479045c9d2fd7702879b73d5988faa2 Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Fri, 21 May 2010 23:46:07 +0200 Subject: - "Snap nodes or handles" button now also includes smooth nodes - Improved snap tooltips (bzr r9440) --- src/selection.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/selection.cpp') diff --git a/src/selection.cpp b/src/selection.cpp index 1e14591fa..96c66e0c5 100644 --- a/src/selection.cpp +++ b/src/selection.cpp @@ -424,14 +424,15 @@ boost::optional Selection::center() const { } /** - * Compute the list of points in the selection that are to be considered for snapping. + * Compute the list of points in the selection that are to be considered for snapping from. */ std::vector Selection::getSnapPoints(SnapPreferences const *snapprefs) const { GSList const *items = const_cast(this)->itemList(); SnapPreferences snapprefs_dummy = *snapprefs; // create a local copy of the snapping prefs snapprefs_dummy.setIncludeItemCenter(false); // locally disable snapping to the item center - + snapprefs_dummy.setSnapToItemNode(true); // consider any type of nodes as a snap source + snapprefs_dummy.setSnapSmoothNodes(true); // i.e. disregard the smooth / cusp node preference std::vector p; for (GSList const *iter = items; iter != NULL; iter = iter->next) { SPItem *this_item = SP_ITEM(iter->data); @@ -446,13 +447,18 @@ std::vector Selection::getSnapPoints(SnapPreferenc return p; } - +// TODO: both getSnapPoints and getSnapPointsConvexHull are called, subsequently. Can we do this more efficient? +// Why do we need to include the transformation center in one case and not the other? std::vector Selection::getSnapPointsConvexHull(SnapPreferences const *snapprefs) const { GSList const *items = const_cast(this)->itemList(); + SnapPreferences snapprefs_dummy = *snapprefs; // create a local copy of the snapping prefs + snapprefs_dummy.setSnapToItemNode(true); // consider any type of nodes as a snap source + snapprefs_dummy.setSnapSmoothNodes(true); // i.e. disregard the smooth / cusp node preference + std::vector p; for (GSList const *iter = items; iter != NULL; iter = iter->next) { - sp_item_snappoints(SP_ITEM(iter->data), p, snapprefs); + sp_item_snappoints(SP_ITEM(iter->data), p, &snapprefs_dummy); } std::vector pHull; -- cgit v1.2.3