summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5349b93)
raw | patch | inline | side by side (parent: 5349b93)
author | dvlierop2 <dvlierop2@users.sourceforge.net> | |
Tue, 20 May 2008 20:58:56 +0000 (20:58 +0000) | ||
committer | dvlierop2 <dvlierop2@users.sourceforge.net> | |
Tue, 20 May 2008 20:58:56 +0000 (20:58 +0000) |
src/seltrans.cpp | patch | blob | history | |
src/snap.cpp | patch | blob | history | |
src/snapper.h | patch | blob | history |
diff --git a/src/seltrans.cpp b/src/seltrans.cpp
index bdb0f794a84a48cc70e1dc26dddcc7da4904af04..2c021a724f98b147a25863ef38a96cbde2ec35b7 100644 (file)
--- a/src/seltrans.cpp
+++ b/src/seltrans.cpp
/* 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]),
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 46d043ec17e46b681b755268dd1a6e1883e602bc..09cdbbaba9571933b5af33eea4d3a352e8bd64f0 100644 (file)
--- a/src/snap.cpp
+++ b/src/snap.cpp
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 1fb03d704b1edf8087a13e0ce4cbfd3eed7215bf..f79573990c285381b2593d84eee445099541ef68 100644 (file)
--- a/src/snapper.h
+++ b/src/snapper.h
NR::Point getDirection() const {
return _direction;
}
+
+ void setPoint(NR::Point const &p) {
+ _point = p;
+ _has_point = true;
+ }
private: