[Pattern] fix mirror_elements and change arg name to axis

This commit is contained in:
jan 2026-02-16 19:21:52 -08:00
commit ed021e3d81

View file

@ -793,18 +793,22 @@ class Pattern(PortList, AnnotatableImpl, Mirrorable):
cast('Rotatable', entry).rotate(rotation)
return self
def mirror_elements(self, across_axis: int = 0) -> Self:
def mirror_elements(self, axis: int = 0) -> Self:
"""
Mirror each shape, ref, and port relative to (0,0).
Mirror each shape, ref, and port relative to its offset.
Args:
across_axis: Axis to mirror across
(0: mirror across x axis, 1: mirror across y axis)
axis: Axis to mirror across
0: mirror across x axis (flip y),
1: mirror across y axis (flip x)
Returns:
self
"""
return self.flip_across(axis=across_axis)
for entry in chain(chain_elements(self.shapes, self.refs), self.ports.values()):
cast('Mirrorable', entry).mirror(axis=axis)
self._log_bulk_update(f"mirror_elements({axis})")
return self
def mirror(self, axis: int = 0) -> Self:
"""