summaryrefslogtreecommitdiffstats
path: root/src/context-fns.cpp
diff options
context:
space:
mode:
authorDiederik van Lierop <mail@diedenrezi.nl>2008-04-30 07:32:12 +0000
committerdvlierop2 <dvlierop2@users.sourceforge.net>2008-04-30 07:32:12 +0000
commit8e980bd257a274f7f32aca2e05f2a694675cf4ef (patch)
tree4b2b83970d640c900a3eadb0266e29a92f088dde /src/context-fns.cpp
parentmerge redundant language-agnostics options into CPPFLAGS, split off linker flags (diff)
downloadinkscape-8e980bd257a274f7f32aca2e05f2a694675cf4ef.tar.gz
inkscape-8e980bd257a274f7f32aca2e05f2a694675cf4ef.zip
- Major refactoring of snapping related code...
- Enabling snap indicator for all remaining tools (bzr r5556)
Diffstat (limited to 'src/context-fns.cpp')
-rw-r--r--src/context-fns.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/context-fns.cpp b/src/context-fns.cpp
index d7333adbe..83048af40 100644
--- a/src/context-fns.cpp
+++ b/src/context-fns.cpp
@@ -85,7 +85,8 @@ NR::Rect Inkscape::snap_rectangular_box(SPDesktop const *desktop, SPItem *item,
bool const shift = state & GDK_SHIFT_MASK;
bool const control = state & GDK_CONTROL_MASK;
- SnapManager const &m = desktop->namedview->snap_manager;
+ SnapManager &m = desktop->namedview->snap_manager;
+ m.setup(desktop, item);
Inkscape::SnappedPoint snappoint;
if (control) {
@@ -132,11 +133,11 @@ NR::Rect Inkscape::snap_rectangular_box(SPDesktop const *desktop, SPItem *item,
/* Try to snap p[0] (the opposite corner) along the constraint vector */
s[0] = m.constrainedSnap(Inkscape::Snapper::SNAPPOINT_NODE, p[0],
- Inkscape::Snapper::ConstraintLine(p[0] - p[1]), item);
+ Inkscape::Snapper::ConstraintLine(p[0] - p[1]));
/* Try to snap p[1] (the dragged corner) along the constraint vector */
s[1] = m.constrainedSnap(Inkscape::Snapper::SNAPPOINT_NODE, p[1],
- Inkscape::Snapper::ConstraintLine(p[1] - p[0]), item);
+ Inkscape::Snapper::ConstraintLine(p[1] - p[0]));
/* Choose the best snap and update points accordingly */
if (s[0].getDistance() < s[1].getDistance()) {
@@ -148,13 +149,14 @@ NR::Rect Inkscape::snap_rectangular_box(SPDesktop const *desktop, SPItem *item,
p[1] = s[1].getPoint();
snappoint = s[1];
}
+ desktop->snapindicator->set_new_snappoint(snappoint);
} else {
/* Our origin is the opposite corner. Snap the drag point along the constraint vector */
p[0] = center;
snappoint = m.constrainedSnap(Inkscape::Snapper::SNAPPOINT_NODE, p[1],
- Inkscape::Snapper::ConstraintLine(p[1] - p[0]), item);
+ Inkscape::Snapper::ConstraintLine(p[1] - p[0]));
p[1] = snappoint.getPoint();
}
@@ -169,8 +171,8 @@ NR::Rect Inkscape::snap_rectangular_box(SPDesktop const *desktop, SPItem *item,
Inkscape::SnappedPoint s[2];
- s[0] = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, p[0], item);
- s[1] = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, p[1], item);
+ s[0] = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, p[0]);
+ s[1] = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, p[1]);
if (s[0].getDistance() < s[1].getDistance()) {
p[0] = s[0].getPoint();
@@ -186,7 +188,7 @@ NR::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;
- snappoint = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, pt, item);
+ snappoint = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, pt);
p[1] = snappoint.getPoint();
}