author | Francesco Abbate <francesco.bbt@gmail.com> | 2012年02月06日 14:15:36 +0100 |
---|---|---|
committer | Francesco Abbate <francesco.bbt@gmail.com> | 2012年02月06日 21:43:56 +0100 |
commit | dcc9ad4b8fbefbd762955b2ececcfd84228f8def (patch) | |
tree | 16b92db718c32fb8628b809e3796f05a82b15d00 | |
parent | 4220a54f85c62a8ad9cb4652325bf4af8afa2390 (diff) | |
download | gsl-shell-dcc9ad4b8fbefbd762955b2ececcfd84228f8def.tar.gz |
-rw-r--r-- | agg-plot/lua-draw.cpp | 5 | ||||
-rw-r--r-- | doc/user-manual/graphics.rst | 5 |
diff --git a/agg-plot/lua-draw.cpp b/agg-plot/lua-draw.cpp index b9a3a13e..4148c3c8 100644 --- a/agg-plot/lua-draw.cpp +++ b/agg-plot/lua-draw.cpp @@ -147,7 +147,10 @@ path_cmd (draw::path *p, int _cmd, struct cmd_call_stack *s) ps.move_to (s->f[0], s->f[1]); break; case CMD_LINE_TO: - ps.line_to (s->f[0], s->f[1]); + if (ps.total_vertices() == 0) + ps.move_to (s->f[0], s->f[1]); + else + ps.line_to (s->f[0], s->f[1]); break; case CMD_CLOSE: ps.close_polygon (); diff --git a/doc/user-manual/graphics.rst b/doc/user-manual/graphics.rst index b331f35c..443acfb2 100644 --- a/doc/user-manual/graphics.rst +++ b/doc/user-manual/graphics.rst @@ -658,6 +658,11 @@ Graphical Objects .. method:: line_to(x, y) Add a line into the path from the previous point to the specified (x, y) coordinates. + As a special case, if the path is empty, this method is equivalent to :meth:`~Path.move_to`. + + .. hint:: + If you want to define a polygonal line you don't need to use the :meth:`~Path.move_to` method for the first point. + Instead you can use the method :meth:`~Path.line_to` to add each point. .. method:: close() |