diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2008-03-04 21:33:35 +0000 |
|---|---|---|
| committer | johanengelen <johanengelen@users.sourceforge.net> | 2008-03-04 21:33:35 +0000 |
| commit | dda8b960727037f690a2df5ead5775e7adf7b5d2 (patch) | |
| tree | 1649c7b172574b1e4da46874ef03f8b5ccf761dd /src/context-fns.cpp | |
| parent | * [INTL: br] Breton update by Alan (diff) | |
| download | inkscape-dda8b960727037f690a2df5ead5775e7adf7b5d2.tar.gz inkscape-dda8b960727037f690a2df5ead5775e7adf7b5d2.zip | |
add snapindicator to rect tool but not satisfactory yet...
(bzr r4962)
Diffstat (limited to 'src/context-fns.cpp')
| -rw-r--r-- | src/context-fns.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/context-fns.cpp b/src/context-fns.cpp index c845fd275..32c7eef00 100644 --- a/src/context-fns.cpp +++ b/src/context-fns.cpp @@ -12,6 +12,7 @@ #include "desktop-affine.h" #include "event-context.h" #include "sp-namedview.h" +#include "display/snap-indicator.h" static const double midpt_1_goldenratio = (1 + goldenratio) / 2; static const double midpt_goldenratio_2 = (goldenratio + 2) / 2; @@ -85,6 +86,7 @@ NR::Rect Inkscape::snap_rectangular_box(SPDesktop const *desktop, SPItem *item, bool const control = state & GDK_CONTROL_MASK; SnapManager const &m = desktop->namedview->snap_manager; + Inkscape::SnappedPoint snappoint; if (control) { @@ -140,17 +142,20 @@ NR::Rect Inkscape::snap_rectangular_box(SPDesktop const *desktop, SPItem *item, if (s[0].getDistance() < s[1].getDistance()) { 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]; } } else { /* Our origin is the opposite corner. Snap the drag point along the constraint vector */ p[0] = center; - p[1] = m.constrainedSnap(Inkscape::Snapper::SNAPPOINT_NODE, p[1], - Inkscape::Snapper::ConstraintLine(p[1] - p[0]), item).getPoint(); + snappoint = m.constrainedSnap(Inkscape::Snapper::SNAPPOINT_NODE, p[1], + Inkscape::Snapper::ConstraintLine(p[1] - p[0]), item); + p[1] = snappoint.getPoint(); } } else if (shift) { @@ -170,16 +175,24 @@ NR::Rect Inkscape::snap_rectangular_box(SPDesktop const *desktop, SPItem *item, if (s[0].getDistance() < s[1].getDistance()) { 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]; } } else { /* There's no constraint on the corner point, so just snap it to anything */ p[0] = center; - p[1] = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, pt, item).getPoint(); + snappoint = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, pt, item); + p[1] = snappoint.getPoint(); + } + + if (snappoint.getDistance() < NR_HUGE) { + // this does not work well enough yet. +// desktop->snapindicator->set_new_snappoint(snappoint.getPoint().to_2geom()); } p[0] = sp_desktop_dt2root_xy_point(desktop, p[0]); |
