Code

now that selection description includes style (filtered, clipped), we need to update...
[inkscape.git] / src / guide-snapper.cpp
index 54a4086a447c311b738530c10c2596a8747f380e..f344d891ff800d0f33fee390c20bf0e3d7f5bb1c 100644 (file)
@@ -15,6 +15,7 @@
 #include "libnr/nr-values.h"
 #include "libnr/nr-point-fns.h"
 #include "sp-namedview.h"
+#include "desktop.h"
 #include "sp-guide.h"
 
 Inkscape::GuideSnapper::GuideSnapper(SnapManager *sm, Geom::Coord const d) : LineSnapper(sm, d)
@@ -22,6 +23,21 @@ Inkscape::GuideSnapper::GuideSnapper(SnapManager *sm, Geom::Coord const d) : Lin
 
 }
 
+/**
+ *  \return Snap tolerance (desktop coordinates); depends on current zoom so that it's always the same in screen pixels
+ */
+Geom::Coord Inkscape::GuideSnapper::getSnapperTolerance() const
+{
+       SPDesktop const *dt = _snapmanager->getDesktop();
+       double const zoom =  dt ? dt->current_zoom() : 1;
+       return _snapmanager->snapprefs.getGuideTolerance() / zoom;
+}
+
+bool Inkscape::GuideSnapper::getSnapperAlwaysSnap() const
+{
+    return _snapmanager->snapprefs.getGuideTolerance() == 10000; //TODO: Replace this threshold of 10000 by a constant; see also tolerance-slider.cpp
+}
+
 Inkscape::GuideSnapper::LineList Inkscape::GuideSnapper::_getSnapLines(Geom::Point const &/*p*/) const
 {
     LineList s;