From 479e0c3c2e0f73a3228a7eec56a5b3ee3a0567a7 Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Sat, 5 Dec 2020 14:50:16 -0800 Subject: [PATCH] fix mirroring for rotated ports/devices --- masque/builder/devices.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/masque/builder/devices.py b/masque/builder/devices.py index 1eca581..519462f 100644 --- a/masque/builder/devices.py +++ b/masque/builder/devices.py @@ -79,7 +79,8 @@ class Port(PositionableImpl, Rotatable, PivotableImpl, Copyable, Mirrorable, met def mirror(self: P, axis: int) -> P: self.offset[1 - axis] *= -1 if self.rotation is not None: - self.rotation += pi + self.rotation *= -1 + self.rotation += axis * pi return self def rotate(self: P, rotation: float) -> P: @@ -606,9 +607,10 @@ class Device(Copyable, Mirrorable): if mirrored[0]: o_offsets[:, 1] *= -1 - o_rotations += pi + o_rotations *= -1 if mirrored[1]: o_offsets[:, 0] *= -1 + o_rotations *= -1 o_rotations += pi type_conflicts = (s_types != o_types) & (s_types != 0) & (o_types != 0)