[transform] Add __eq__ / __ne__ to DecomposedTransform
This commit is contained in:
parent
ef6903e097
commit
c3175b271a
@ -422,6 +422,26 @@ class DecomposedTransform:
|
||||
tCenterX: float = 0
|
||||
tCenterY: float = 0
|
||||
|
||||
def __eq__(self, other):
|
||||
if not isinstance(other, DecomposedTransform):
|
||||
return NotImplemented
|
||||
return (
|
||||
self.translateX == other.translateX
|
||||
and self.translateY == other.translateY
|
||||
and self.rotation == other.rotation
|
||||
and self.scaleX == other.scaleX
|
||||
and self.scaleY == other.scaleY
|
||||
and self.skewX == other.skewX
|
||||
and self.skewY == other.skewY
|
||||
and self.tCenterX == other.tCenterX
|
||||
and self.tCenterY == other.tCenterY
|
||||
)
|
||||
|
||||
def __ne__(self, other):
|
||||
if not isinstance(other, DecomposedTransform):
|
||||
return NotImplemented
|
||||
return not self == other
|
||||
|
||||
@classmethod
|
||||
def fromTransform(self, transform):
|
||||
# Adapted from an answer on
|
||||
|
Loading…
x
Reference in New Issue
Block a user