From 2999a8c604d02808c82893eae9ed5418bc937442 Mon Sep 17 00:00:00 2001 From: dvlierop2 Date: Wed, 8 Jul 2009 19:30:45 +0000 Subject: [PATCH] When translating too many nodes, a convex hull is used for snapping. This is not needed when "only snap node closest to mouse pointer" has been enabled in the preferences (fixes bug #396070) --- src/seltrans.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/seltrans.cpp b/src/seltrans.cpp index 64f7d3cdc..3bd5f611a 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -244,6 +244,7 @@ void Inkscape::SelTrans::setCenter(Geom::Point const &p) void Inkscape::SelTrans::grab(Geom::Point const &p, gdouble x, gdouble y, bool show_handles) { Inkscape::Selection *selection = sp_desktop_selection(_desktop); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); g_return_if_fail(!_grabbed); @@ -296,7 +297,11 @@ void Inkscape::SelTrans::grab(Geom::Point const &p, gdouble x, gdouble y, bool s /* 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 (s)he could hardly discern which node would be snapping */ - _snap_points = snap_points_hull; + if (prefs->getBool("/options/snapclosestonly/value", false)) { + _keepClosestPointOnly(_snap_points, p); + } else { + _snap_points = snap_points_hull; + } // Unfortunately, by now we will have lost the font-baseline snappoints :-( } @@ -333,7 +338,7 @@ void Inkscape::SelTrans::grab(Geom::Point const &p, gdouble x, gdouble y, bool s // When snapping the node closest to the mouse pointer is absolutely preferred over the closest snap // (i.e. when weight == 1), then we will not even try to snap to other points and discard those other // points immediately. - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + if (prefs->getBool("/options/snapclosestonly/value", false)) { if (m.snapprefs.getSnapModeNode()) { _keepClosestPointOnly(_snap_points, p); @@ -357,7 +362,6 @@ void Inkscape::SelTrans::grab(Geom::Point const &p, gdouble x, gdouble y, bool s } } - // Optionally, show the snap source if (!(_state == STATE_ROTATE && x != 0.5 && y != 0.5)) { // but not when we're draging a rotation handle, because that won't snap // Now either _bbox_points or _snap_points has a single element, the other one has zero..... or both have zero elements -- 2.30.2