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
def handle_transforms(self, element, mobject):
x, y = 0, 0
try:
x = self.attribute_to_float(element.getAttribute('x'))
# Flip y
y = -self.attribute_to_float(element.getAttribute('y'))
mobject.shift([x, y, 0])
except Exception:
pass
x, y = (
self.attribute_to_float(element.getAttribute(key))
if element.hasAttribute(key)
else 0.0
for key in ("x", "y")
)
mobject.shift(x * RIGHT + y * DOWN)
transform_names = [
"matrix",