diff options
| author | Diederik van Lierop <mailat-signdiedenrezidotnl> | 2010-11-17 21:17:44 +0000 |
|---|---|---|
| committer | Diederik van Lierop <mailat-signdiedenrezidotnl> | 2010-11-17 21:17:44 +0000 |
| commit | a6ba6ad5e29d23ba866e4d8bda61b4f18e053ba1 (patch) | |
| tree | 036cc9271c4e6ecafe6ffcf75318eb13df63bb4b /src/seltrans.cpp | |
| parent | Extensions. Removing tooltips from color>randomize (see Bug #676419). (diff) | |
| download | inkscape-a6ba6ad5e29d23ba866e4d8bda61b4f18e053ba1.tar.gz inkscape-a6ba6ad5e29d23ba866e4d8bda61b4f18e053ba1.zip | |
Shift should disable snapping when dragging the rotation center of an object
(bzr r9903)
Diffstat (limited to 'src/seltrans.cpp')
| -rw-r--r-- | src/seltrans.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/seltrans.cpp b/src/seltrans.cpp index 5a8e5d3db..cdfcee742 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -1323,26 +1323,30 @@ gboolean Inkscape::SelTrans::rotateRequest(Geom::Point &pt, guint state) // Move the item's transformation center gboolean Inkscape::SelTrans::centerRequest(Geom::Point &pt, guint state) { - SnapManager &m = _desktop->namedview->snap_manager; - m.setup(_desktop); - // When dragging the transformation center while multiple items have been selected, then those // items will share a single center. While dragging that single center, it should never snap to the // centers of any of the selected objects. Therefore we will have to pass the list of selected items // to the snapper, to avoid self-snapping of the rotation center GSList *items = (GSList *) const_cast<Selection *>(_selection)->itemList(); + SnapManager &m = _desktop->namedview->snap_manager; + m.setup(_desktop); m.setRotationCenterSource(items); - m.freeSnapReturnByRef(pt, Inkscape::SNAPSOURCE_ROTATION_CENTER); - m.unSetup(); - if (state & GDK_CONTROL_MASK) { - if ( fabs(_point[Geom::X] - pt[Geom::X]) > fabs(_point[Geom::Y] - pt[Geom::Y]) ) { - pt[Geom::Y] = _point[Geom::Y]; - } else { - pt[Geom::X] = _point[Geom::X]; + if (state & GDK_CONTROL_MASK) { // with Ctrl, constrain to axes + std::vector<Inkscape::Snapper::SnapConstraint> constraints; + constraints.push_back(Inkscape::Snapper::SnapConstraint(_point, Geom::Point(1, 0))); + constraints.push_back(Inkscape::Snapper::SnapConstraint(_point, Geom::Point(0, 1))); + Inkscape::SnappedPoint sp = m.multipleConstrainedSnaps(Inkscape::SnapCandidatePoint(pt, Inkscape::SNAPSOURCE_ROTATION_CENTER), constraints, state & GDK_SHIFT_MASK); + pt = sp.getPoint(); + } + else { + if (!(state & GDK_SHIFT_MASK)) { // Shift disables snapping + m.freeSnapReturnByRef(pt, Inkscape::SNAPSOURCE_ROTATION_CENTER); } } + m.unSetup(); + // status text GString *xs = SP_PX_TO_METRIC_STRING(pt[Geom::X], _desktop->namedview->getDefaultMetric()); GString *ys = SP_PX_TO_METRIC_STRING(pt[Geom::Y], _desktop->namedview->getDefaultMetric()); |
