[Path / PolyCollection / Polygon] fix order of rotation/offset

This commit is contained in:
Jan Petykiewicz 2025-10-26 21:36:29 -07:00
parent fe231e558a
commit ee4147ef99
3 changed files with 6 additions and 7 deletions

View File

@ -212,10 +212,10 @@ class Path(Shape):
self.width = width self.width = width
self.cap = cap self.cap = cap
self.cap_extensions = cap_extensions self.cap_extensions = cap_extensions
if numpy.any(offset):
self.translate(offset)
if rotation: if rotation:
self.rotate(rotation) self.rotate(rotation)
if numpy.any(offset):
self.translate(offset)
def __deepcopy__(self, memo: dict | None = None) -> 'Path': def __deepcopy__(self, memo: dict | None = None) -> 'Path':
memo = {} if memo is None else memo memo = {} if memo is None else memo

View File

@ -112,10 +112,10 @@ class PolyCollection(Shape):
self._vertex_offsets = numpy.asarray(vertex_offsets, dtype=numpy.intp) self._vertex_offsets = numpy.asarray(vertex_offsets, dtype=numpy.intp)
self.repetition = repetition self.repetition = repetition
self.annotations = annotations self.annotations = annotations
if numpy.any(offset):
self.translate(offset)
if rotation: if rotation:
self.rotate(rotation) self.rotate(rotation)
if numpy.any(offset):
self.translate(offset)
def __deepcopy__(self, memo: dict | None = None) -> Self: def __deepcopy__(self, memo: dict | None = None) -> Self:
memo = {} if memo is None else memo memo = {} if memo is None else memo

View File

@ -119,7 +119,6 @@ class Polygon(Shape):
) -> None: ) -> None:
if raw: if raw:
assert isinstance(vertices, numpy.ndarray) assert isinstance(vertices, numpy.ndarray)
assert isinstance(offset, numpy.ndarray)
self._vertices = vertices self._vertices = vertices
self._repetition = repetition self._repetition = repetition
self._annotations = annotations self._annotations = annotations
@ -127,10 +126,10 @@ class Polygon(Shape):
self.vertices = vertices self.vertices = vertices
self.repetition = repetition self.repetition = repetition
self.annotations = annotations self.annotations = annotations
if numpy.any(offset):
self.translate(offset)
if rotation: if rotation:
self.rotate(rotation) self.rotate(rotation)
if numpy.any(offset):
self.translate(offset)
def __deepcopy__(self, memo: dict | None = None) -> 'Polygon': def __deepcopy__(self, memo: dict | None = None) -> 'Polygon':
memo = {} if memo is None else memo memo = {} if memo is None else memo