diff options
Diffstat (limited to 'src/context-fns.cpp')
| -rw-r--r-- | src/context-fns.cpp | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/src/context-fns.cpp b/src/context-fns.cpp index 83048af40..61b6a2fc4 100644 --- a/src/context-fns.cpp +++ b/src/context-fns.cpp @@ -86,7 +86,7 @@ NR::Rect Inkscape::snap_rectangular_box(SPDesktop const *desktop, SPItem *item, bool const control = state & GDK_CONTROL_MASK; SnapManager &m = desktop->namedview->snap_manager; - m.setup(desktop, item); + m.setup(NULL, item); Inkscape::SnappedPoint snappoint; if (control) { @@ -141,23 +141,27 @@ NR::Rect Inkscape::snap_rectangular_box(SPDesktop const *desktop, SPItem *item, /* Choose the best snap and update points accordingly */ if (s[0].getDistance() < s[1].getDistance()) { - p[0] = s[0].getPoint(); - p[1] = 2 * center - s[0].getPoint(); - snappoint = s[0]; + if (s[0].getSnapped()) { + p[0] = s[0].getPoint(); + p[1] = 2 * center - s[0].getPoint(); + snappoint = s[0]; + } } else { - p[0] = 2 * center - s[1].getPoint(); - p[1] = s[1].getPoint(); - snappoint = s[1]; + if (s[1].getSnapped()) { + p[0] = 2 * center - s[1].getPoint(); + 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])); - p[1] = snappoint.getPoint(); + if (snappoint.getSnapped()) { + p[1] = snappoint.getPoint(); + } } } else if (shift) { @@ -175,13 +179,17 @@ NR::Rect Inkscape::snap_rectangular_box(SPDesktop const *desktop, SPItem *item, s[1] = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, p[1]); if (s[0].getDistance() < s[1].getDistance()) { - p[0] = s[0].getPoint(); - p[1] = 2 * center - s[0].getPoint(); - snappoint = s[0]; + if (s[0].getSnapped()) { + p[0] = s[0].getPoint(); + p[1] = 2 * center - s[0].getPoint(); + snappoint = s[0]; + } } else { - p[0] = 2 * center - s[1].getPoint(); - p[1] = s[1].getPoint(); - snappoint = s[1]; + if (s[1].getSnapped()) { + p[0] = 2 * center - s[1].getPoint(); + p[1] = s[1].getPoint(); + snappoint = s[1]; + } } } else { @@ -189,12 +197,13 @@ 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); - p[1] = snappoint.getPoint(); + if (snappoint.getSnapped()) { + p[1] = snappoint.getPoint(); + } } if (snappoint.getSnapped()) { - // this does not work well enough yet. -// desktop->snapindicator->set_new_snappoint(snappoint); + desktop->snapindicator->set_new_snappoint(snappoint); } p[0] = sp_desktop_dt2root_xy_point(desktop, p[0]); |
