From ee4147ef99bcdba02e2234c0a7c66e2b86e71363 Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Sun, 26 Oct 2025 21:36:29 -0700 Subject: [PATCH] [Path / PolyCollection / Polygon] fix order of rotation/offset --- masque/shapes/path.py | 4 ++-- masque/shapes/poly_collection.py | 4 ++-- masque/shapes/polygon.py | 5 ++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/masque/shapes/path.py b/masque/shapes/path.py index b9d2d4d..7778428 100644 --- a/masque/shapes/path.py +++ b/masque/shapes/path.py @@ -212,10 +212,10 @@ class Path(Shape): self.width = width self.cap = cap self.cap_extensions = cap_extensions - if numpy.any(offset): - self.translate(offset) if rotation: self.rotate(rotation) + if numpy.any(offset): + self.translate(offset) def __deepcopy__(self, memo: dict | None = None) -> 'Path': memo = {} if memo is None else memo diff --git a/masque/shapes/poly_collection.py b/masque/shapes/poly_collection.py index e37d417..b7fbe48 100644 --- a/masque/shapes/poly_collection.py +++ b/masque/shapes/poly_collection.py @@ -112,10 +112,10 @@ class PolyCollection(Shape): self._vertex_offsets = numpy.asarray(vertex_offsets, dtype=numpy.intp) self.repetition = repetition self.annotations = annotations - if numpy.any(offset): - self.translate(offset) if rotation: self.rotate(rotation) + if numpy.any(offset): + self.translate(offset) def __deepcopy__(self, memo: dict | None = None) -> Self: memo = {} if memo is None else memo diff --git a/masque/shapes/polygon.py b/masque/shapes/polygon.py index 6b27606..fc17f61 100644 --- a/masque/shapes/polygon.py +++ b/masque/shapes/polygon.py @@ -119,7 +119,6 @@ class Polygon(Shape): ) -> None: if raw: assert isinstance(vertices, numpy.ndarray) - assert isinstance(offset, numpy.ndarray) self._vertices = vertices self._repetition = repetition self._annotations = annotations @@ -127,10 +126,10 @@ class Polygon(Shape): self.vertices = vertices self.repetition = repetition self.annotations = annotations - if numpy.any(offset): - self.translate(offset) if rotation: self.rotate(rotation) + if numpy.any(offset): + self.translate(offset) def __deepcopy__(self, memo: dict | None = None) -> 'Polygon': memo = {} if memo is None else memo