15 lines
567 B
Python
15 lines
567 B
Python
class PositionScale:
|
|
def __init__(self, position: tuple[float, float] = (0, 0), scale: tuple[float, float] = (1, 1)):
|
|
self.position: tuple[float, float] = position
|
|
self.scale: tuple[float, float] = scale
|
|
|
|
def apply_scale_to_position(self):
|
|
return self.position[0] * self.scale[0], self.position[1] * self.scale[1]
|
|
|
|
@staticmethod
|
|
def combine(a, b):
|
|
return PositionScale(
|
|
(a.position[0] + b.position[0], a.position[1] + b.position[1]),
|
|
(a.scale[0] * b.scale[0], a.scale[1] * b.scale[1])
|
|
)
|