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/rect-context.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/rect-context.cpp')
| -rw-r--r-- | src/rect-context.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/rect-context.cpp b/src/rect-context.cpp index 6aa7d418c..70d7b7721 100644 --- a/src/rect-context.cpp +++ b/src/rect-context.cpp @@ -23,6 +23,7 @@ #include "macros.h" #include "display/sp-canvas.h" +#include "display/snap-indicator.h" #include "sp-rect.h" #include "document.h" #include "sp-namedview.h" @@ -283,6 +284,8 @@ static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent event_context->tolerance = prefs_get_int_attribute_limited("options.dragtolerance", "value", 0, 0, 100); + desktop->snapindicator->remove_snappoint(); + gint ret = FALSE; switch (event->type) { case GDK_BUTTON_PRESS: @@ -305,8 +308,11 @@ static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent /* Snap center */ SnapManager const &m = desktop->namedview->snap_manager; - rc->center = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, - button_dt, rc->item).getPoint(); + Inkscape::SnappedPoint s = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, button_dt, rc->item); + rc->center = s.getPoint(); + if (s.getDistance() < NR_HUGE) { + desktop->snapindicator->set_new_snappoint(s.getPoint().to_2geom()); + } sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate), ( GDK_KEY_PRESS_MASK | @@ -336,8 +342,12 @@ static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent NR::Point motion_dt(desktop->w2d(motion_w)); SnapManager const &m = desktop->namedview->snap_manager; - motion_dt = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, motion_dt, rc->item).getPoint(); - + Inkscape::SnappedPoint s = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, motion_dt, rc->item); + motion_dt = s.getPoint(); + if (s.getDistance() < NR_HUGE) { + desktop->snapindicator->set_new_snappoint(s.getPoint().to_2geom()); + } + sp_rect_drag(*rc, motion_dt, event->motion.state); gobble_motion_events(GDK_BUTTON1_MASK); ret = TRUE; |
