Skip to content

fix path reversal, computation of path proxy, end points and control points for multiple subpaths

What does the merge request do?

Closes #450 (closed)

The path computation methods for paths with multiple subpaths was wrong. A new zone is created with every Z/z and M/m command, and we need to remember that position as new "first" point of the path. Previously, the "first" point was only set at the beginning.

This affected path reversal, path proxy, end points and control points. For path.transform, it was fixed in !230 (merged) already.

New output of "Number nodes" on the example file in #450 (closed):

image

Implementation notes

I've added a rather extensive unit test. Some previous unit tests changed to visually identical output; I think the new behavior of the reverse function is more correct. If a line does the same as the following Z command (i.e. the Z command only closes, but doesn't draw anything), then only use the Z commando instead of adding an extra command.) This way the number of commands of the reversed path is identical to that of the original path.

Summary for release notes

Extensions that query properties of paths with multiple subpaths now get more correct results if that path uses relative path commands.

Checklist

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

Merge request reports