[Pattern] fix mirror_elements and change arg name to axis
This commit is contained in:
parent
07a25ec290
commit
ed021e3d81
1 changed files with 9 additions and 5 deletions
|
|
@ -793,18 +793,22 @@ class Pattern(PortList, AnnotatableImpl, Mirrorable):
|
||||||
cast('Rotatable', entry).rotate(rotation)
|
cast('Rotatable', entry).rotate(rotation)
|
||||||
return self
|
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:
|
Args:
|
||||||
across_axis: Axis to mirror across
|
axis: Axis to mirror across
|
||||||
(0: mirror across x axis, 1: mirror across y axis)
|
0: mirror across x axis (flip y),
|
||||||
|
1: mirror across y axis (flip x)
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
self
|
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:
|
def mirror(self, axis: int = 0) -> Self:
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue