summaryrefslogtreecommitdiffstats
path: root/src/context-fns.cpp
diff options
context:
space:
mode:
authorDiederik van Lierop <mailat-signdiedenrezidotnl>2010-01-09 21:14:38 +0000
committerDiederik van Lierop <mailat-signdiedenrezidotnl>2010-01-09 21:14:38 +0000
commite8f4c644181a8a68e2c33e1783f77a400dc1a29f (patch)
tree38083930039a3507ff467c62cf2e588a229a061f /src/context-fns.cpp
parentPatch by Alex Leone to fix crash with recursive masks from 190130, I also add... (diff)
downloadinkscape-e8f4c644181a8a68e2c33e1783f77a400dc1a29f.tar.gz
inkscape-e8f4c644181a8a68e2c33e1783f77a400dc1a29f.zip
Refactoring the snapping API (making it easier to maintain and understand for the devs)
(bzr r8960)
Diffstat (limited to 'src/context-fns.cpp')
-rw-r--r--src/context-fns.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/context-fns.cpp b/src/context-fns.cpp
index 8e4b6384c..67a7d6baa 100644
--- a/src/context-fns.cpp
+++ b/src/context-fns.cpp
@@ -131,12 +131,12 @@ Geom::Rect Inkscape::snap_rectangular_box(SPDesktop const *desktop, SPItem *item
Inkscape::SnappedPoint s[2];
/* Try to snap p[0] (the opposite corner) along the constraint vector */
- s[0] = m.constrainedSnap(Inkscape::SnapPreferences::SNAPPOINT_NODE, to_2geom(p[0]), Inkscape::SNAPSOURCE_HANDLE,
- Inkscape::Snapper::ConstraintLine(p[0] - p[1]), false);
+ s[0] = m.constrainedSnap(Inkscape::SnapPreferences::SNAPPOINT_NODE, Inkscape::SnapCandidatePoint(p[0], Inkscape::SNAPSOURCE_HANDLE),
+ Inkscape::Snapper::ConstraintLine(p[0] - p[1]));
/* Try to snap p[1] (the dragged corner) along the constraint vector */
- s[1] = m.constrainedSnap(Inkscape::SnapPreferences::SNAPPOINT_NODE, to_2geom(p[1]), Inkscape::SNAPSOURCE_HANDLE,
- Inkscape::Snapper::ConstraintLine(p[1] - p[0]), false);
+ s[1] = m.constrainedSnap(Inkscape::SnapPreferences::SNAPPOINT_NODE, Inkscape::SnapCandidatePoint(p[1], Inkscape::SNAPSOURCE_HANDLE),
+ Inkscape::Snapper::ConstraintLine(p[1] - p[0]));
/* Choose the best snap and update points accordingly */
if (s[0].getSnapDistance() < s[1].getSnapDistance()) {
@@ -156,8 +156,8 @@ Geom::Rect Inkscape::snap_rectangular_box(SPDesktop const *desktop, SPItem *item
/* Our origin is the opposite corner. Snap the drag point along the constraint vector */
p[0] = center;
- snappoint = m.constrainedSnap(Inkscape::SnapPreferences::SNAPPOINT_NODE, to_2geom(p[1]), Inkscape::SNAPSOURCE_HANDLE,
- Inkscape::Snapper::ConstraintLine(p[1] - p[0]), false);
+ snappoint = m.constrainedSnap(Inkscape::SnapPreferences::SNAPPOINT_NODE, Inkscape::SnapCandidatePoint(p[1], Inkscape::SNAPSOURCE_HANDLE),
+ Inkscape::Snapper::ConstraintLine(p[1] - p[0]));
if (snappoint.getSnapped()) {
p[1] = snappoint.getPoint();
}
@@ -174,8 +174,8 @@ Geom::Rect Inkscape::snap_rectangular_box(SPDesktop const *desktop, SPItem *item
Inkscape::SnappedPoint s[2];
- s[0] = m.freeSnap(Inkscape::SnapPreferences::SNAPPOINT_NODE, to_2geom(p[0]), Inkscape::SNAPSOURCE_HANDLE);
- s[1] = m.freeSnap(Inkscape::SnapPreferences::SNAPPOINT_NODE, to_2geom(p[1]), Inkscape::SNAPSOURCE_HANDLE);
+ s[0] = m.freeSnap(Inkscape::SnapPreferences::SNAPPOINT_NODE, Inkscape::SnapCandidatePoint(p[0], Inkscape::SNAPSOURCE_HANDLE));
+ s[1] = m.freeSnap(Inkscape::SnapPreferences::SNAPPOINT_NODE, Inkscape::SnapCandidatePoint(p[1], Inkscape::SNAPSOURCE_HANDLE));
if (s[0].getSnapDistance() < s[1].getSnapDistance()) {
if (s[0].getSnapped()) {
@@ -196,7 +196,7 @@ Geom::Rect Inkscape::snap_rectangular_box(SPDesktop const *desktop, SPItem *item
/* There's no constraint on the corner point, so just snap it to anything */
p[0] = center;
p[1] = pt;
- snappoint = m.freeSnap(Inkscape::SnapPreferences::SNAPPOINT_NODE, to_2geom(pt), Inkscape::SNAPSOURCE_HANDLE);
+ snappoint = m.freeSnap(Inkscape::SnapPreferences::SNAPPOINT_NODE, Inkscape::SnapCandidatePoint(pt, Inkscape::SNAPSOURCE_HANDLE));
if (snappoint.getSnapped()) {
p[1] = snappoint.getPoint();
}