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/snapper.cpp | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) (limited to 'src/snapper.cpp') diff --git a/src/snapper.cpp b/src/snapper.cpp index 492e4ca4d..4a0bfb791 100644 --- a/src/snapper.cpp +++ b/src/snapper.cpp @@ -21,36 +21,11 @@ */ Inkscape::Snapper::Snapper(SnapManager *sm, Geom::Coord const t) : _snapmanager(sm), - _snap_enabled(true), - _snapper_tolerance(std::max(t, 1.0)) + _snap_enabled(true) { g_assert(_snapmanager != NULL); } -/** - * Set snap tolerance. - * \param d New snap tolerance (desktop coordinates) - */ -void Inkscape::Snapper::setSnapperTolerance(Geom::Coord const d) -{ - _snapper_tolerance = std::max(d, 1.0); -} - -/** - * \return Snap tolerance (desktop coordinates); depends on current zoom so that it's always the same in screen pixels - */ -Geom::Coord Inkscape::Snapper::getSnapperTolerance() const -{ - SPDesktop const *dt = _snapmanager->getDesktop(); - double const zoom = dt ? dt->current_zoom() : 1; - return _snapper_tolerance / zoom; -} - -bool Inkscape::Snapper::getSnapperAlwaysSnap() const -{ - return _snapper_tolerance == 10000; //TODO: Replace this threshold of 10000 by a constant; see also tolerance-slider.cpp -} - /** * \param s true to enable this snapper, otherwise false. */ -- cgit v1.2.3