svg_path_editor.path_change_origin#

Functions#

change_path_origin(svg, new_origin_index[, subpath])

Return a new path where the origin of a (sub)path is moved.

Module Contents#

svg_path_editor.path_change_origin.change_path_origin(svg, new_origin_index, subpath=None)[source]#

Return a new path where the origin of a (sub)path is moved.

The command at new_origin_index becomes the first command of the affected subpath segment; all items of that subpath are rotated accordingly. If subpath is True, only the subpath containing new_origin_index is transformed; if False/None, the whole path is treated as a single segment.

Parameters:
  • svg (SvgPath) – Original path to transform.

  • new_origin_index (int) – Index of the command that should become the new origin within its subpath.

  • subpath (bool | None) – If True, restrict the change to the subpath containing new_origin_index; if False or None, treat the full path segment as one subpath.

Returns:

A new SvgPath instance with the origin moved and the path representation optimized.

Return type:

SvgPath