diff options
| author | Diederik van Lierop <mailat-signdiedenrezidotnl> | 2010-07-24 12:37:50 +0000 |
|---|---|---|
| committer | Diederik van Lierop <mailat-signdiedenrezidotnl> | 2010-07-24 12:37:50 +0000 |
| commit | a96bb3e891e103864fe501a92bad96a9ad04351e (patch) | |
| tree | 2da50f7f546322c122ac26884870f87e03b613c5 /src/seltrans.cpp | |
| parent | support for transform elements (Bug 600473) (diff) | |
| download | inkscape-a96bb3e891e103864fe501a92bad96a9ad04351e.tar.gz inkscape-a96bb3e891e103864fe501a92bad96a9ad04351e.zip | |
Avoid self-snapping when dragging a rotation center, and draw the rotation center at the snapped position
(bzr r9641)
Diffstat (limited to 'src/seltrans.cpp')
| -rw-r--r-- | src/seltrans.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/seltrans.cpp b/src/seltrans.cpp index b9bf4c6ce..764c222a8 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -883,7 +883,11 @@ gboolean Inkscape::SelTrans::handleRequest(SPKnot *knot, Geom::Point *position, if (handle.request(this, handle, *position, state)) { sp_knot_set_position(knot, *position, state); SP_CTRL(_grip)->moveto(*position); - SP_CTRL(_norm)->moveto(_origin); + if (&handle == &handle_center) { + SP_CTRL(_norm)->moveto(*position); + } else { + SP_CTRL(_norm)->moveto(_origin); + } } return TRUE; @@ -1329,7 +1333,18 @@ gboolean Inkscape::SelTrans::centerRequest(Geom::Point &pt, guint state) { SnapManager &m = _desktop->namedview->snap_manager; m.setup(_desktop); - m.freeSnapReturnByRef(pt, Inkscape::SNAPSOURCE_OTHER_HANDLE); + + // Center is being dragged for the first item in the selection only + // Find out which item is first ... + GSList *items = (GSList *) const_cast<Selection *>(_selection)->itemList(); + SPItem *first = NULL; + if (items) { + first = reinterpret_cast<SPItem*>(g_slist_last(items)->data); // from the first item in selection + } + // ... and store that item because later on we need to make sure that + // this transformation center won't snap to itself + m.setRotationCenterSource(first); + m.freeSnapReturnByRef(pt, Inkscape::SNAPSOURCE_ROTATION_CENTER); if (state & GDK_CONTROL_MASK) { if ( fabs(_point[Geom::X] - pt[Geom::X]) > fabs(_point[Geom::Y] - pt[Geom::Y]) ) { |
