Code

Prevent the Bezier tool from introducing a redundant closing line segment
authorKrzysztof Kosiński <tweenk.pl@gmail.com>
Wed, 10 Feb 2010 15:46:07 +0000 (16:46 +0100)
committerKrzysztof Kosiński <tweenk.pl@gmail.com>
Wed, 10 Feb 2010 15:46:07 +0000 (16:46 +0100)
when closing a path.

src/display/curve.cpp

index 7d7dbc987664c417bb894503eccc40695d6c45a6..7c3c3d48074e6529228d66cd4badf1c5a82f5cb2 100644 (file)
@@ -285,7 +285,11 @@ SPCurve::closepath()
 void
 SPCurve::closepath_current()
 {
-    _pathv.back().setFinal(_pathv.back().initialPoint());
+    if (_pathv.back().size() > 0 && dynamic_cast<Geom::LineSegment const *>(&_pathv.back().back_open())) {
+        _pathv.back().erase_last();
+    } else {
+        _pathv.back().setFinal(_pathv.back().initialPoint());
+    }
     _pathv.back().close(true);
 }