diff options
| author | Diederik van Lierop <mail@diedenrezi.nl> | 2009-04-12 11:38:21 +0000 |
|---|---|---|
| committer | dvlierop2 <dvlierop2@users.sourceforge.net> | 2009-04-12 11:38:21 +0000 |
| commit | 92e3a3aa6fedb352e7a20d87d2480a0a504e541a (patch) | |
| tree | cf18174de25be64e06960d3715440b74edf3467e /src/seltrans.cpp | |
| parent | Fix two missing icons in live effect parameters (diff) | |
| download | inkscape-92e3a3aa6fedb352e7a20d87d2480a0a504e541a.tar.gz inkscape-92e3a3aa6fedb352e7a20d87d2480a0a504e541a.zip | |
Fix snapping during constrained translation, when only snapping the node closest to the mouse pointer
(bzr r7687)
Diffstat (limited to 'src/seltrans.cpp')
| -rw-r--r-- | src/seltrans.cpp | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/src/seltrans.cpp b/src/seltrans.cpp index 1ee7faff8..816a471cf 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -1416,25 +1416,23 @@ void Inkscape::SelTrans::moveTo(Geom::Point const &xy, guint state) /* Snap to things, and also constrain to horizontal or vertical movement */ - for (unsigned int dim = 0; dim < 2; dim++) { - // When doing a constrained translation, all points will move in the same direction, i.e. - // either horizontally or vertically. Therefore we only have to specify the direction of - // the constraint-line once. The constraint lines are parallel, but might not be colinear. - // Therefore we will have to set the point through which the constraint-line runs - // individually for each point to be snapped; this will be handled however by _snapTransformed() - s.push_back(m.constrainedSnapTranslation(Inkscape::SnapPreferences::SNAPPOINT_BBOX, - _bbox_points, - _point, - Inkscape::Snapper::ConstraintLine(component_vectors[dim]), - dxy)); - - s.push_back(m.constrainedSnapTranslation(Inkscape::SnapPreferences::SNAPPOINT_NODE, - _snap_points, - _point, - Inkscape::Snapper::ConstraintLine(component_vectors[dim]), - dxy)); - } - + unsigned int dim = fabs(dxy[Geom::X]) > fabs(dxy[Geom::Y]) ? Geom::X : Geom::Y; + // When doing a constrained translation, all points will move in the same direction, i.e. + // either horizontally or vertically. Therefore we only have to specify the direction of + // the constraint-line once. The constraint lines are parallel, but might not be colinear. + // Therefore we will have to set the point through which the constraint-line runs + // individually for each point to be snapped; this will be handled however by _snapTransformed() + s.push_back(m.constrainedSnapTranslation(Inkscape::SnapPreferences::SNAPPOINT_BBOX, + _bbox_points, + _point, + Inkscape::Snapper::ConstraintLine(component_vectors[dim]), + dxy)); + + s.push_back(m.constrainedSnapTranslation(Inkscape::SnapPreferences::SNAPPOINT_NODE, + _snap_points, + _point, + Inkscape::Snapper::ConstraintLine(component_vectors[dim]), + dxy)); } else { // Let's leave this timer code here for a while. I'll probably need it in the near future (Diederik van Lierop) @@ -1443,7 +1441,7 @@ void Inkscape::SelTrans::moveTo(Geom::Point const &xy, guint state) g_get_current_time(&starttime); */ /* Snap to things with no constraint */ - s.push_back(m.freeSnapTranslation(Inkscape::SnapPreferences::SNAPPOINT_BBOX, _bbox_points, _point, dxy)); + s.push_back(m.freeSnapTranslation(Inkscape::SnapPreferences::SNAPPOINT_BBOX, _bbox_points, _point, dxy)); s.push_back(m.freeSnapTranslation(Inkscape::SnapPreferences::SNAPPOINT_NODE, _snap_points, _point, dxy)); /*g_get_current_time(&endtime); |
