Small repositioning

This commit is contained in:
Grant Sanderson 2020-06-26 21:53:26 -07:00
parent 9d03f40be2
commit 9a2b2ecd9e

View file

@ -49,7 +49,7 @@ class SVGMobject(VMobject):
digest_config(self, kwargs)
self.file_name = file_name or self.file_name
self.ensure_valid_file()
VMobject.__init__(self, **kwargs)
super().__init__(**kwargs)
self.move_into_position()
def ensure_valid_file(self):
@ -68,6 +68,14 @@ class SVGMobject(VMobject):
return
raise IOError(f"No file matching {file_name} in image directory")
def move_into_position(self):
if self.should_center:
self.center()
if self.height is not None:
self.set_height(self.height)
if self.width is not None:
self.set_width(self.width)
def init_points(self):
doc = minidom.parse(self.file_path)
self.ref_to_element = {}
@ -312,14 +320,6 @@ class SVGMobject(VMobject):
new_refs = dict([(e.getAttribute('id'), e) for e in self.get_all_childNodes_have_id(defs)])
self.ref_to_element.update(new_refs)
def move_into_position(self):
if self.should_center:
self.center()
if self.height is not None:
self.set_height(self.height)
if self.width is not None:
self.set_width(self.width)
class VMobjectFromSVGPathstring(VMobject):
CONFIG = {