summaryrefslogtreecommitdiffstats
path: root/src/sp-shape.cpp
diff options
context:
space:
mode:
authorDiederik van Lierop <mailat-signdiedenrezidotnl>2010-07-24 12:37:50 +0000
committerDiederik van Lierop <mailat-signdiedenrezidotnl>2010-07-24 12:37:50 +0000
commita96bb3e891e103864fe501a92bad96a9ad04351e (patch)
tree2da50f7f546322c122ac26884870f87e03b613c5 /src/sp-shape.cpp
parentsupport for transform elements (Bug 600473) (diff)
downloadinkscape-a96bb3e891e103864fe501a92bad96a9ad04351e.tar.gz
inkscape-a96bb3e891e103864fe501a92bad96a9ad04351e.zip
Avoid self-snapping when dragging a rotation center, and draw the rotation center at the snapped position
(bzr r9641)
Diffstat (limited to 'src/sp-shape.cpp')
-rw-r--r--src/sp-shape.cpp90
1 files changed, 45 insertions, 45 deletions
diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp
index 0038908bf..b64ad45e0 100644
--- a/src/sp-shape.cpp
+++ b/src/sp-shape.cpp
@@ -1208,57 +1208,57 @@ static void sp_shape_snappoints(SPItem const *item, std::vector<Inkscape::SnapCa
for(Geom::PathVector::const_iterator path_it = pathv.begin(); path_it != pathv.end(); ++path_it) {
if (snapprefs->getSnapToItemNode()) {
- // Add the first point of the path
- p.push_back(Inkscape::SnapCandidatePoint(path_it->initialPoint() * i2d, Inkscape::SNAPSOURCE_NODE_CUSP, Inkscape::SNAPTARGET_NODE_CUSP));
+ // Add the first point of the path
+ p.push_back(Inkscape::SnapCandidatePoint(path_it->initialPoint() * i2d, Inkscape::SNAPSOURCE_NODE_CUSP, Inkscape::SNAPTARGET_NODE_CUSP));
}
Geom::Path::const_iterator curve_it1 = path_it->begin(); // incoming curve
Geom::Path::const_iterator curve_it2 = ++(path_it->begin()); // outgoing curve
while (curve_it1 != path_it->end_default())
{
- // For each path: consider midpoints of line segments for snapping
- if (snapprefs->getSnapLineMidpoints()) { // only do this when we're snapping nodes (enforces strict snapping)
- if (Geom::LineSegment const* line_segment = dynamic_cast<Geom::LineSegment const*>(&(*curve_it1))) {
- p.push_back(Inkscape::SnapCandidatePoint(Geom::middle_point(*line_segment) * i2d, Inkscape::SNAPSOURCE_LINE_MIDPOINT, Inkscape::SNAPTARGET_LINE_MIDPOINT));
- }
- }
-
- if (curve_it2 == path_it->end_default()) { // Test will only pass for the last iteration of the while loop
- if (snapprefs->getSnapToItemNode() && !path_it->closed()) {
- // Add the last point of the path, but only for open paths
- // (for closed paths the first and last point will coincide)
- p.push_back(Inkscape::SnapCandidatePoint((*curve_it1).finalPoint() * i2d, Inkscape::SNAPSOURCE_NODE_CUSP, Inkscape::SNAPTARGET_NODE_CUSP));
- }
- } else {
- /* Test whether to add the node between curve_it1 and curve_it2.
- * Loop to end_default (so only iterating through the stroked part); */
-
- Geom::NodeType nodetype = Geom::get_nodetype(*curve_it1, *curve_it2);
-
- bool c1 = snapprefs->getSnapToItemNode() && (nodetype == Geom::NODE_CUSP || nodetype == Geom::NODE_NONE);
- bool c2 = snapprefs->getSnapSmoothNodes() && (nodetype == Geom::NODE_SMOOTH || nodetype == Geom::NODE_SYMM);
-
- if (c1 || c2) {
- Inkscape::SnapSourceType sst;
- Inkscape::SnapTargetType stt;
- switch (nodetype) {
- case Geom::NODE_CUSP:
- sst = Inkscape::SNAPSOURCE_NODE_CUSP;
- stt = Inkscape::SNAPTARGET_NODE_CUSP;
- break;
- case Geom::NODE_SMOOTH:
- case Geom::NODE_SYMM:
- sst = Inkscape::SNAPSOURCE_NODE_SMOOTH;
- stt = Inkscape::SNAPTARGET_NODE_SMOOTH;
- break;
- default:
- sst = Inkscape::SNAPSOURCE_UNDEFINED;
- stt = Inkscape::SNAPTARGET_UNDEFINED;
- break;
- }
- p.push_back(Inkscape::SnapCandidatePoint(curve_it1->finalPoint() * i2d, sst, stt));
- }
- }
+ // For each path: consider midpoints of line segments for snapping
+ if (snapprefs->getSnapLineMidpoints()) { // only do this when we're snapping nodes (enforces strict snapping)
+ if (Geom::LineSegment const* line_segment = dynamic_cast<Geom::LineSegment const*>(&(*curve_it1))) {
+ p.push_back(Inkscape::SnapCandidatePoint(Geom::middle_point(*line_segment) * i2d, Inkscape::SNAPSOURCE_LINE_MIDPOINT, Inkscape::SNAPTARGET_LINE_MIDPOINT));
+ }
+ }
+
+ if (curve_it2 == path_it->end_default()) { // Test will only pass for the last iteration of the while loop
+ if (snapprefs->getSnapToItemNode() && !path_it->closed()) {
+ // Add the last point of the path, but only for open paths
+ // (for closed paths the first and last point will coincide)
+ p.push_back(Inkscape::SnapCandidatePoint((*curve_it1).finalPoint() * i2d, Inkscape::SNAPSOURCE_NODE_CUSP, Inkscape::SNAPTARGET_NODE_CUSP));
+ }
+ } else {
+ /* Test whether to add the node between curve_it1 and curve_it2.
+ * Loop to end_default (so only iterating through the stroked part); */
+
+ Geom::NodeType nodetype = Geom::get_nodetype(*curve_it1, *curve_it2);
+
+ bool c1 = snapprefs->getSnapToItemNode() && (nodetype == Geom::NODE_CUSP || nodetype == Geom::NODE_NONE);
+ bool c2 = snapprefs->getSnapSmoothNodes() && (nodetype == Geom::NODE_SMOOTH || nodetype == Geom::NODE_SYMM);
+
+ if (c1 || c2) {
+ Inkscape::SnapSourceType sst;
+ Inkscape::SnapTargetType stt;
+ switch (nodetype) {
+ case Geom::NODE_CUSP:
+ sst = Inkscape::SNAPSOURCE_NODE_CUSP;
+ stt = Inkscape::SNAPTARGET_NODE_CUSP;
+ break;
+ case Geom::NODE_SMOOTH:
+ case Geom::NODE_SYMM:
+ sst = Inkscape::SNAPSOURCE_NODE_SMOOTH;
+ stt = Inkscape::SNAPTARGET_NODE_SMOOTH;
+ break;
+ default:
+ sst = Inkscape::SNAPSOURCE_UNDEFINED;
+ stt = Inkscape::SNAPTARGET_UNDEFINED;
+ break;
+ }
+ p.push_back(Inkscape::SnapCandidatePoint(curve_it1->finalPoint() * i2d, sst, stt));
+ }
+ }
++curve_it1;
++curve_it2;