Code

fix node counting for "moveto"-only paths.
authorjohanengelen <johanengelen@users.sourceforge.net>
Mon, 28 Sep 2009 22:15:36 +0000 (22:15 +0000)
committerjohanengelen <johanengelen@users.sourceforge.net>
Mon, 28 Sep 2009 22:15:36 +0000 (22:15 +0000)
src/display/curve.cpp

index 5a1e2abebcd7f2975f1581895a67391c636cb596..7d7dbc987664c417bb894503eccc40695d6c45a6 100644 (file)
@@ -629,10 +629,14 @@ SPCurve::nodes_in_path() const
 
         nr++; // count last node (this works also for closed paths because although they don't have a 'last node', they do have an extra segment
 
-        if (it->closed()) {
+        // do not count closing knot double for zero-length closing line segments
+        // however, if the path is only a moveto, and is closed, do not subtract 1 (otherwise the result will be zero nodes)
+        if ( it->closed()
+             && ((*it).size() != 0) )
+        {
             Geom::Curve const &c = it->back_closed();
             if (are_near(c.initialPoint(), c.finalPoint())) {
-                nr--;   // do not count closing knot double for zero-length closing line segments
+                nr--;   
             }
         }
     }