various fixes
This commit is contained in:
parent
b98553a770
commit
d14182998b
6 changed files with 31 additions and 24 deletions
|
|
@ -94,7 +94,7 @@ class PositionableImpl(Positionable, metaclass=ABCMeta):
|
|||
|
||||
@offset.setter
|
||||
def offset(self, val: vector2):
|
||||
if not isinstance(val, numpy.ndarray):
|
||||
if not isinstance(val, numpy.ndarray) or val.dtype != numpy.float64:
|
||||
val = numpy.array(val, dtype=float)
|
||||
|
||||
if val.size != 2:
|
||||
|
|
@ -109,7 +109,6 @@ class PositionableImpl(Positionable, metaclass=ABCMeta):
|
|||
self.offset = offset
|
||||
return self
|
||||
|
||||
|
||||
def translate(self: I, offset: vector2) -> I:
|
||||
self._offset += offset
|
||||
return self
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@ class PivotableImpl(Pivotable, metaclass=ABCMeta):
|
|||
"""
|
||||
__slots__ = ()
|
||||
|
||||
@abstractmethod
|
||||
def rotate_around(self: J, pivot: vector2, rotation: float) -> J:
|
||||
pivot = numpy.array(pivot, dtype=float)
|
||||
self.translate(-pivot)
|
||||
|
|
|
|||
Loading…
Reference in a new issue