Code

Extensions. Restack patch for bug #524481 (restack extension hangs for drawings with...
[inkscape.git] / src / snapped-point.cpp
index f598cc624f9fe03f37c06e2f1b8d354f3ef46e4b..52f0a7839b0468c10035ed913711822124733bdd 100644 (file)
@@ -61,7 +61,7 @@ Inkscape::SnappedPoint::SnappedPoint()
 {
     _point = Geom::Point(0,0);
     _source = SNAPSOURCE_UNDEFINED,
-    _source_num = 0,
+    _source_num = -1,
     _target = SNAPTARGET_UNDEFINED,
     _at_intersection = false;
     _constrained_snap = false;
@@ -81,7 +81,7 @@ Inkscape::SnappedPoint::SnappedPoint(Geom::Point const &p)
 {
     _point = p;
     _source = SNAPSOURCE_UNDEFINED,
-    _source_num = 0,
+    _source_num = -1,
     _target = SNAPTARGET_UNDEFINED,
     _at_intersection = false;
     _fully_constrained = false;
@@ -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()) {
@@ -127,7 +127,7 @@ bool getClosestSP(std::list<Inkscape::SnappedPoint> const &list, Inkscape::Snapp
 bool Inkscape::SnappedPoint::isOtherSnapBetter(Inkscape::SnappedPoint const &other_one, bool weighted) const
 {
 
-    if (!other_one.getSnapped()) {
+    if (getSnapped() && !other_one.getSnapped()) {
         return false;
     }
 
@@ -170,10 +170,10 @@ bool Inkscape::SnappedPoint::isOtherSnapBetter(Inkscape::SnappedPoint const &oth
     // When snapping to a constraint line only, which is not really a snap but merely a projection
     // to the constraint line, then give this snap a very low priority. Basically, any other snap will do
     if (other_one.getTarget() == SNAPTARGET_CONSTRAINT) {
-        dist_other += NR_HUGE/2;
+        dist_other += 1e6;
     }
     if (getTarget() == SNAPTARGET_CONSTRAINT) {
-        dist_this += NR_HUGE/2;
+        dist_this += 1e6;
     }
 
     // If it's closer