Code

Fix paraxial pen tool: apply constraint even if we didn't snap
authorDiederik van Lierop <mailat-signdiedenrezidotnl>
Sun, 24 Oct 2010 11:14:28 +0000 (13:14 +0200)
committerDiederik van Lierop <mailat-signdiedenrezidotnl>
Sun, 24 Oct 2010 11:14:28 +0000 (13:14 +0200)
src/snap.cpp
src/snapped-point.cpp
src/snapped-point.h

index cac3824ab4c406c643ec3c295f0a179d1ca085c8..e14ef6ae9258c50374402bc83ec384b4bbb27b76 100644 (file)
@@ -179,7 +179,7 @@ void SnapManager::freeSnapReturnByRef(Geom::Point &p,
                                       Geom::OptRect const &bbox_to_snap) const
 {
     Inkscape::SnappedPoint const s = freeSnap(Inkscape::SnapCandidatePoint(p, source_type), bbox_to_snap);
-    s.getPoint(p);
+    s.getPointIfSnapped(p);
 }
 
 
@@ -343,7 +343,7 @@ void SnapManager::constrainedSnapReturnByRef(Geom::Point &p,
                                              Geom::OptRect const &bbox_to_snap) const
 {
     Inkscape::SnappedPoint const s = constrainedSnap(Inkscape::SnapCandidatePoint(p, source_type), constraint, bbox_to_snap);
-    s.getPoint(p);
+    p = s.getPoint(); // If we didn't snap, then we will return the point projected onto the constraint
 }
 
 /**
@@ -498,7 +498,7 @@ void SnapManager::guideFreeSnap(Geom::Point &p, Geom::Point const &guide_normal,
 
     Inkscape::SnappedPoint const s = findBestSnap(candidate, sc, false, false);
 
-    s.getPoint(p);
+    s.getPointIfSnapped(p);
 }
 
 /**
@@ -542,7 +542,7 @@ void SnapManager::guideConstrainedSnap(Geom::Point &p, SPGuide const &guideline)
     }
 
     Inkscape::SnappedPoint const s = findBestSnap(candidate, sc, false);
-    s.getPoint(p);
+    s.getPointIfSnapped(p);
 }
 
 /**
index 48efa10e6fd3dacb1c51ee0ac7b6f311c0cf751a..22daf9103f7626d12a2e7889ca2032daeceeaa8c 100644 (file)
@@ -100,7 +100,7 @@ Inkscape::SnappedPoint::~SnappedPoint()
 {
 }
 
-void Inkscape::SnappedPoint::getPoint(Geom::Point &p) const
+void Inkscape::SnappedPoint::getPointIfSnapped(Geom::Point &p) const
 {
     // When we have snapped
     if (getSnapped()) {
index 4b4882ee41bae54370ad8a108155e0eef0b83fb1..a28712e85f519f13b9d2017c2f08c86c229f6fd9 100644 (file)
@@ -48,7 +48,7 @@ public:
      * to, because it only returns a point if snapping has actually occurred
      * (by overwriting p)
      */
-    void getPoint(Geom::Point &p) const;
+    void getPointIfSnapped(Geom::Point &p) const;
 
     /* This method however always returns a point, even if no snapping
      * has occurred; A check should be implemented in the calling code