Skip to content

Fix some small issues with Paths and clones

Jonathan Neuhauser requested to merge joneuhauser/extensions:path-fixes into master

What does the merge request do?

Some improvements that I made during my XAML work, and factored out on request by @doctormo.

  • The get_path method of different polygons previously returned strings for some and Paths for other classes. This has been made consistent, they now all return a path. The method signature in the base class has been typehinted.
  • The <line> element was incorrectly converted to path. There was an extra ClosePath command in there. This is noticeable when e.g. computing the length of a line. According to the specification, it is defined as
    • perform an absolute moveto operation to absolute location (x1,y1)
    • perform an absolute lineto operation to absolute location (x2,y2)
  • When unlinking clones, the x and y attribute is now taken into account (Inkscape doesn't set them itself, but it's perfectly legal to have both transform and x, y); the unit test tests this against sample output of core Inkscape's unlink clone functionality.
  • The path parser now returns when there are less arguments than expected, this is what the specification wants. It also says to inform the user when such an error occurs if possible, but handling this silently is probably preferrable.
  • Added documentation to bezier.py.

Summary for release notes

Several small fixes that makes working with paths and clones more predictable and robust.

Checklist

  • Add unit tests (if applicable)
  • Changes to inkex/ are well documented
  • Clean merge request history
Edited by Jonathan Neuhauser

Merge request reports