summaryrefslogtreecommitdiffstats
path: root/src/snap.cpp
diff options
context:
space:
mode:
authorDiederik van Lierop <mailat-signdiedenrezidotnl>2010-07-26 20:45:01 +0000
committerDiederik van Lierop <mailat-signdiedenrezidotnl>2010-07-26 20:45:01 +0000
commit073f9069a756df6736c077257a6678a56c38176d (patch)
tree285217543b375a3e8162bf06ba27cc38ad2b34f8 /src/snap.cpp
parentAdded preference to suppress auto-refresh of icon previews. (diff)
downloadinkscape-073f9069a756df6736c077257a6678a56c38176d.tar.gz
inkscape-073f9069a756df6736c077257a6678a56c38176d.zip
While rotating, don't try snapping points coincident with the rotation center
(bzr r9652)
Diffstat (limited to 'src/snap.cpp')
-rw-r--r--src/snap.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/snap.cpp b/src/snap.cpp
index bac37737f..810e2dd8b 100644
--- a/src/snap.cpp
+++ b/src/snap.cpp
@@ -585,8 +585,18 @@ Inkscape::SnappedPoint SnapManager::_snapTransformed(
// calculate that line here
dedicated_constraint = Inkscape::Snapper::SnapConstraint(origin, b);
} else if (transformation_type == ROTATE) {
- // Geom::L2(b) is the radius of the circular constraint
- dedicated_constraint = Inkscape::Snapper::SnapConstraint(origin, b, Geom::L2(b));
+ Geom::Coord r = Geom::L2(b); // the radius of the circular constraint
+ if (r < 1e-9) { // points too close to the rotation center will not move. Don't try to snap these
+ // as they will always yield a perfect snap result if they're already snapped beforehand (e.g.
+ // when the transformation center has been snapped to a grid intersection in the selector tool)
+ continue; // skip this SnapCandidate and continue with the next one
+ // PS1: Apparently we don't have to do this for skewing, but why?
+ // PS2: We cannot easily filter these points upstream, e.g. in the grab() method (seltrans.cpp)
+ // because the rotation center will change when pressing shift, and grab() won't be recalled.
+ // Filtering could be done in handleRequest() (again in seltrans.cpp), by iterating through
+ // the snap candidates. But hey, we're iterating here anyway.
+ }
+ dedicated_constraint = Inkscape::Snapper::SnapConstraint(origin, b, r);
} else if (transformation_type == STRETCH) { // when non-uniform stretching {
dedicated_constraint = Inkscape::Snapper::SnapConstraint((*i).getPoint(), component_vectors[dim]);
} else if (transformation_type == TRANSLATE) {
@@ -702,9 +712,9 @@ Inkscape::SnappedPoint SnapManager::_snapTransformed(
snapped_point.setSecondSnapDistance(NR_HUGE);
break;
case ROTATE:
- // a is vector to snapped point; b is vector to original point; now lets calculate angle between a and b
- result[0] = atan2(Geom::dot(Geom::rot90(b), a), Geom::dot(b, a));
- result[1] = result[1]; // how else should we store an angle in a point ;-)
+ // a is vector to snapped point; b is vector to original point; now lets calculate angle between a and b
+ result[0] = atan2(Geom::dot(Geom::rot90(b), a), Geom::dot(b, a));
+ result[1] = result[1]; // how else should we store an angle in a point ;-)
// Store the metric for this transformation as a virtual distance (we're storing an angle)
snapped_point.setSnapDistance(std::abs(result[0] - transformation[0]));
snapped_point.setSecondSnapDistance(NR_HUGE);