From 07d32ff9bade493f2549e8e90c32d11ba12b199d Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Sat, 31 Jan 2009 13:51:52 +0000 Subject: Store the snapper tolerances in the snap-preferences instead of in each snapper individualy. This way we don't have to update all snappers when the namedview has been updated (and we can get rid of the _update_snap_distances() call) (bzr r7208) --- src/object-snapper.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/object-snapper.cpp') diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp index f5021e208..7b4a989a8 100644 --- a/src/object-snapper.cpp +++ b/src/object-snapper.cpp @@ -63,6 +63,21 @@ Inkscape::ObjectSnapper::~ObjectSnapper() delete _paths_to_snap_to; } +/** + * \return Snap tolerance (desktop coordinates); depends on current zoom so that it's always the same in screen pixels + */ +Geom::Coord Inkscape::ObjectSnapper::getSnapperTolerance() const +{ + SPDesktop const *dt = _snapmanager->getDesktop(); + double const zoom = dt ? dt->current_zoom() : 1; + return _snapmanager->snapprefs.getObjectTolerance() / zoom; +} + +bool Inkscape::ObjectSnapper::getSnapperAlwaysSnap() const +{ + return _snapmanager->snapprefs.getObjectTolerance() == 10000; //TODO: Replace this threshold of 10000 by a constant; see also tolerance-slider.cpp +} + /** * Find all items within snapping range. * \param parent Pointer to the document's root, or to a clipped path or mask object -- cgit v1.2.3