diff options
| author | Diederik van Lierop <mail@diedenrezi.nl> | 2009-01-31 13:51:52 +0000 |
|---|---|---|
| committer | dvlierop2 <dvlierop2@users.sourceforge.net> | 2009-01-31 13:51:52 +0000 |
| commit | 07d32ff9bade493f2549e8e90c32d11ba12b199d (patch) | |
| tree | e23af978f1919af10ac80d315f90d8323bb2d0ee /src/guide-snapper.cpp | |
| parent | * [INTL:pl] Further small updates to the Polish translation (diff) | |
| download | inkscape-07d32ff9bade493f2549e8e90c32d11ba12b199d.tar.gz inkscape-07d32ff9bade493f2549e8e90c32d11ba12b199d.zip | |
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)
Diffstat (limited to 'src/guide-snapper.cpp')
| -rw-r--r-- | src/guide-snapper.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/guide-snapper.cpp b/src/guide-snapper.cpp index 54a4086a4..f344d891f 100644 --- a/src/guide-snapper.cpp +++ b/src/guide-snapper.cpp @@ -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; |
