some refactors

This commit is contained in:
TonyCrane 2022-01-25 21:48:04 +08:00
parent 790bf0a104
commit 8db1164ece
No known key found for this signature in database
GPG key ID: 2313A5058A9C637C

View file

@ -237,14 +237,13 @@ class SVGMobject(VMobject):
return mob return mob
def handle_transforms(self, element, mobject): def handle_transforms(self, element, mobject):
x, y = 0, 0 x, y = (
try: self.attribute_to_float(element.getAttribute(key))
x = self.attribute_to_float(element.getAttribute('x')) if element.hasAttribute(key)
# Flip y else 0.0
y = -self.attribute_to_float(element.getAttribute('y')) for key in ("x", "y")
mobject.shift([x, y, 0]) )
except Exception: mobject.shift(x * RIGHT + y * DOWN)
pass
transform_names = [ transform_names = [
"matrix", "matrix",