X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcontext-fns.cpp;h=15138a10b6f9f188de86ce7b794526e33691b5bd;hb=13ebe987b9a246ccd1a6d7968e1bf608fa497c56;hp=6c36e780fdcae26a54590d849619e939e7f47be7;hpb=f951374eef04129c6a0d213e7ab4d9ed2095ca69;p=inkscape.git diff --git a/src/context-fns.cpp b/src/context-fns.cpp index 6c36e780f..15138a10b 100644 --- a/src/context-fns.cpp +++ b/src/context-fns.cpp @@ -1,3 +1,7 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include "sp-item.h" #include "desktop.h" @@ -7,6 +11,7 @@ #include "snap.h" #include "desktop-affine.h" #include "event-context.h" +#include "sp-namedview.h" /* FIXME: could probably use a template here */ @@ -76,7 +81,7 @@ 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); + SnapManager const &m = desktop->namedview->snap_manager; if (control) { @@ -107,12 +112,12 @@ NR::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::Snapper::SNAP_POINT, - p[0], p[0] - p[1], item); + s[0] = m.constrainedSnap(Inkscape::Snapper::SNAP_POINT, p[0], + Inkscape::Snapper::ConstraintLine(p[0] - p[1]), item); /* Try to snap p[1] (the dragged corner) along the constraint vector */ - s[1] = m.constrainedSnap(Inkscape::Snapper::SNAP_POINT, - p[1], p[1] - p[0], item); + s[1] = m.constrainedSnap(Inkscape::Snapper::SNAP_POINT, p[1], + Inkscape::Snapper::ConstraintLine(p[1] - p[0]), item); /* Choose the best snap and update points accordingly */ if (s[0].getDistance() < s[1].getDistance()) { @@ -127,7 +132,8 @@ NR::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; - p[1] = m.constrainedSnap(Inkscape::Snapper::SNAP_POINT, p[1], p[1] - p[0], item).getPoint(); + p[1] = m.constrainedSnap(Inkscape::Snapper::SNAP_POINT, p[1], + Inkscape::Snapper::ConstraintLine(p[1] - p[0]), item).getPoint(); } } else if (shift) {