[Mirrorable / Flippable] Bifurcate mirror into flip (relative to line) vs mirror (relative to own offset/origin)
This commit is contained in:
parent
accad3db9f
commit
44986bac67
11 changed files with 115 additions and 111 deletions
|
|
@ -384,7 +384,6 @@ class Arc(PositionableImpl, Shape):
|
|||
return self
|
||||
|
||||
def mirror(self, axis: int = 0) -> 'Arc':
|
||||
self.offset[1 - axis] *= -1
|
||||
self.rotation *= -1
|
||||
self.rotation += axis * pi
|
||||
self.angles *= -1
|
||||
|
|
|
|||
|
|
@ -189,7 +189,6 @@ class Ellipse(PositionableImpl, Shape):
|
|||
return self
|
||||
|
||||
def mirror(self, axis: int = 0) -> Self:
|
||||
self.offset[1 - axis] *= -1
|
||||
self.rotation *= -1
|
||||
self.rotation += axis * pi
|
||||
return self
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ import numpy
|
|||
from numpy.typing import NDArray, ArrayLike
|
||||
|
||||
from ..traits import (
|
||||
Rotatable, Mirrorable, Copyable, Scalable,
|
||||
Positionable, PivotableImpl, RepeatableImpl, AnnotatableImpl,
|
||||
Rotatable, Mirrorable, Copyable, Scalable, FlippableImpl,
|
||||
Positionable, Pivotable, PivotableImpl, RepeatableImpl, AnnotatableImpl,
|
||||
)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
|
|
@ -26,8 +26,9 @@ normalized_shape_tuple = tuple[
|
|||
DEFAULT_POLY_NUM_VERTICES = 24
|
||||
|
||||
|
||||
class Shape(Positionable, Rotatable, Mirrorable, Copyable, Scalable,
|
||||
PivotableImpl, RepeatableImpl, AnnotatableImpl, metaclass=ABCMeta):
|
||||
class Shape(Positionable, Rotatable, FlippableImpl, Copyable, Scalable,
|
||||
AnnotatableImpl, RepeatableImpl, PivotableImpl, Pivotable,
|
||||
metaclass=ABCMeta):
|
||||
"""
|
||||
Class specifying functions common to all shapes.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ class Text(PositionableImpl, RotatableImpl, Shape):
|
|||
*,
|
||||
offset: ArrayLike = (0.0, 0.0),
|
||||
rotation: float = 0.0,
|
||||
mirrored: bool = False,
|
||||
repetition: Repetition | None = None,
|
||||
annotations: annotations_t = None,
|
||||
raw: bool = False,
|
||||
|
|
@ -80,6 +81,7 @@ class Text(PositionableImpl, RotatableImpl, Shape):
|
|||
self._string = string
|
||||
self._height = height
|
||||
self._rotation = rotation
|
||||
self._mirrored = mirrored
|
||||
self._repetition = repetition
|
||||
self._annotations = annotations
|
||||
else:
|
||||
|
|
@ -87,6 +89,7 @@ class Text(PositionableImpl, RotatableImpl, Shape):
|
|||
self.string = string
|
||||
self.height = height
|
||||
self.rotation = rotation
|
||||
self.mirrored = mirrored
|
||||
self.repetition = repetition
|
||||
self.annotations = annotations
|
||||
self.font_path = font_path
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue