From d0d3e7f80dafc80e47c9a95bf31c14283010a2c2 Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Sat, 8 Dec 2012 21:29:18 +0100 Subject: Selector tool: improve responsiveness for snapping a path's internal intersections (was unbearable already for paths having 20+ segments) (bzr r11937) --- src/selection.cpp | 34 +--------------------------------- 1 file changed, 1 insertion(+), 33 deletions(-) (limited to 'src/selection.cpp') diff --git a/src/selection.cpp b/src/selection.cpp index d769b402c..72f50137c 100644 --- a/src/selection.cpp +++ b/src/selection.cpp @@ -443,15 +443,13 @@ std::vector Selection::getSnapPoints(SnapPreferenc SnapPreferences snapprefs_dummy = *snapprefs; // create a local copy of the snapping prefs snapprefs_dummy.setTargetSnappable(Inkscape::SNAPTARGET_ROTATION_CENTER, false); // locally disable snapping to the item center - //snapprefs_dummy.setTargetSnappable(Inkscape::SNAPTARGET_NODE_CUSP, true); // consider any type of nodes as a snap source - //snapprefs_dummy.setTargetSnappable(Inkscape::SNAPTARGET_NODE_SMOOTH, 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); this_item->getSnappoints(p, &snapprefs_dummy); //Include the transformation origin for snapping - //For a selection or group only the overall origin is considered + //For a selection or group only the overall center is considered, not for each item individually if (snapprefs != NULL && snapprefs->isTargetSnappable(Inkscape::SNAPTARGET_ROTATION_CENTER)) { p.push_back(Inkscape::SnapCandidatePoint(this_item->getCenter(), SNAPSOURCE_ROTATION_CENTER)); } @@ -460,36 +458,6 @@ 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.setTargetSnappable(Inkscape::SNAPTARGET_NODE_CUSP, true); // consider any type of nodes as a snap source - snapprefs_dummy.setTargetSnappable(Inkscape::SNAPTARGET_NODE_SMOOTH, true); // i.e. disregard the smooth / cusp node preference - - std::vector p; - for (GSList const *iter = items; iter != NULL; iter = iter->next) { - SP_ITEM(iter->data)->getSnappoints(p, &snapprefs_dummy); - } - - std::vector pHull; - if (!p.empty()) { - Geom::Rect cvh((p.front()).getPoint(), (p.front()).getPoint()); - for (std::vector::iterator i = p.begin(); i != p.end(); ++i) { - // these are the points we get back - cvh.expandTo((*i).getPoint()); - } - - for ( unsigned i = 0 ; i < 4 ; ++i ) { - pHull.push_back(Inkscape::SnapCandidatePoint(cvh.corner(i), SNAPSOURCE_CONVEX_HULL_CORNER)); - } - } - - return pHull; -} - void Selection::_removeObjectDescendants(SPObject *obj) { GSList *iter, *next; for ( iter = _objs ; iter ; iter = next ) { -- cgit v1.2.3