diff options
| author | Diederik van Lierop <mailat-signdiedenrezidotnl> | 2010-02-22 22:18:29 +0000 |
|---|---|---|
| committer | Diederik van Lierop <mailat-signdiedenrezidotnl> | 2010-02-22 22:18:29 +0000 |
| commit | 76e1015affb07da45fb04e3f7a5a6d9d7c5a272c (patch) | |
| tree | 995a1ecf9acea987acd9cbceab40512ca8625c0c /src/snap.cpp | |
| parent | Disabled unfinished connection point edit mode. Added inkscape:connection-sta... (diff) | |
| download | inkscape-76e1015affb07da45fb04e3f7a5a6d9d7c5a272c.tar.gz inkscape-76e1015affb07da45fb04e3f7a5a6d9d7c5a272c.zip | |
1) Making snapping behaviour for paraxial lines (in the pen tool) similar to other tools
2) Always apply the constraint when asking for a constrained snap
3) Show snap indicator when applying a constraint
(bzr r9105)
Diffstat (limited to 'src/snap.cpp')
| -rw-r--r-- | src/snap.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/snap.cpp b/src/snap.cpp index 1033b0a2c..53832994f 100644 --- a/src/snap.cpp +++ b/src/snap.cpp @@ -357,9 +357,14 @@ Inkscape::SnappedPoint SnapManager::constrainedSnap(Inkscape::SnapCandidatePoint // First project the mouse pointer onto the constraint Geom::Point pp = constraint.projection(p.getPoint()); + Inkscape::SnappedPoint no_snap = Inkscape::SnappedPoint(pp, p.getSourceType(), p.getSourceNum(), Inkscape::SNAPTARGET_CONSTRAINT, Geom::L2(pp - p.getPoint()), 0, false, false); + if (!someSnapperMightSnap()) { - // The constraint should always be enforce, so we return pp here instead of p - return Inkscape::SnappedPoint(pp, p.getSourceType(), p.getSourceNum(), Inkscape::SNAPTARGET_UNDEFINED, NR_HUGE, 0, false, false); + // The constraint should always be enforced, so we return pp here instead of p + if (_snapindicator) { + _desktop->snapindicator->set_new_snaptarget(no_snap); + } + return no_snap; } // Then try to snap the projected point @@ -371,7 +376,17 @@ Inkscape::SnappedPoint SnapManager::constrainedSnap(Inkscape::SnapCandidatePoint (*i)->constrainedSnap(sc, candidate, bbox_to_snap, constraint, &_items_to_ignore); } - return findBestSnap(candidate, sc, true); + Inkscape::SnappedPoint result = findBestSnap(candidate, sc, true); + + if (result.getSnapped()) { + return result; + } + + // The constraint should always be enforced, so we return pp here instead of p + if (_snapindicator) { + _desktop->snapindicator->set_new_snaptarget(no_snap); + } + return no_snap; } /** |
