diff options
| author | Diederik van Lierop <mail@diedenrezi.nl> | 2008-05-20 20:58:56 +0000 |
|---|---|---|
| committer | dvlierop2 <dvlierop2@users.sourceforge.net> | 2008-05-20 20:58:56 +0000 |
| commit | 93983e214d1e01a2973dfd89d56f467ecc752442 (patch) | |
| tree | b309898de26853716c129680f331eddcabf6ee46 /src | |
| parent | Improve snapping behaviour when creating new shapes (diff) | |
| download | inkscape-93983e214d1e01a2973dfd89d56f467ecc752442.tar.gz inkscape-93983e214d1e01a2973dfd89d56f467ecc752442.zip | |
Fix snapping for constrained translation in the selector tool
(bzr r5722)
Diffstat (limited to 'src')
| -rw-r--r-- | src/seltrans.cpp | 8 | ||||
| -rw-r--r-- | src/snap.cpp | 8 | ||||
| -rw-r--r-- | src/snapper.h | 5 |
3 files changed, 17 insertions, 4 deletions
diff --git a/src/seltrans.cpp b/src/seltrans.cpp index bdb0f794a..2c021a724 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -1386,6 +1386,11 @@ void Inkscape::SelTrans::moveTo(NR::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::Snapper::SNAPPOINT_BBOX, _bbox_points, Inkscape::Snapper::ConstraintLine(component_vectors[dim]), @@ -1418,13 +1423,10 @@ void Inkscape::SelTrans::moveTo(NR::Point const &xy, guint state) g_assert(best_snapped_point.getDistance() == NR_HUGE); for (std::list<Inkscape::SnappedPoint>::const_iterator i = s.begin(); i != s.end(); i++) { if (i->getSnapped()) { - // std::cout << "moveTo() -> snapped to point: " << i->getPoint() << " with transformation: " << i->getTransformation(); if (i->getDistance() < best_snapped_point.getDistance()) { best_snapped_point = *i; dxy = i->getTransformation(); - // std::cout << " SEL"; } - //std::cout << std::endl; } } if (best_snapped_point.getSnapped()) { diff --git a/src/snap.cpp b/src/snap.cpp index 46d043ec1..09cdbbaba 100644 --- a/src/snap.cpp +++ b/src/snap.cpp @@ -432,7 +432,13 @@ Inkscape::SnappedPoint SnapManager::_snapTransformed( dedicated_constraint = Inkscape::Snapper::ConstraintLine(origin, (*i) - origin); } else if (transformation_type == STRETCH) { // when non-uniform stretching { dedicated_constraint = Inkscape::Snapper::ConstraintLine((*i), component_vectors[dim]); - } // else: leave the original constraint, e.g. for constrained translation and skewing + } else if (transformation_type == TRANSLATION) { + // When doing a constrained translation, all points will move in the same direction, i.e. + // either horizontally or vertically. The lines along which they move are therefore all + // parallel, but might not be colinear. Therefore we will have to set the point through + // which the constraint-line runs here, for each point individually. + dedicated_constraint.setPoint(*i); + } // else: leave the original constraint, e.g. for skewing if (transformation_type == SCALE && !uniform) { g_warning("Non-uniform constrained scaling is not supported!"); } diff --git a/src/snapper.h b/src/snapper.h index 1fb03d704..f79573990 100644 --- a/src/snapper.h +++ b/src/snapper.h @@ -88,6 +88,11 @@ public: NR::Point getDirection() const { return _direction; } + + void setPoint(NR::Point const &p) { + _point = p; + _has_point = true; + } private: |
