Merge pull request #349 from sswatson/patch-4

SVG single-factor scaling
This commit is contained in:
Devin Neal 2018-12-04 17:01:53 -08:00 committed by GitHub
commit a4f1e762d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -264,8 +264,13 @@ class SVGMobject(VMobject):
if not transform.startswith(prefix) or not transform.endswith(suffix):
raise Exception()
transform = transform[len(prefix):-len(suffix)]
scale_x, scale_y = string_to_numbers(transform)
mobject.scale(np.array([scale_x, scale_y, 1]))
scale_values = string_to_numbers(transform)
if len(scale_values) == 2:
scale_x, scale_y = scale_values
mobject.scale(np.array([scale_x, scale_y, 1]))
elif len(scale_values) == 1:
scale = scale_values[0]
mobject.scale(np.array([scale,scale,1]), about_point = ORIGIN)
except:
pass