mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Small repositioning
This commit is contained in:
parent
9d03f40be2
commit
9a2b2ecd9e
1 changed files with 9 additions and 9 deletions
|
@ -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 = {
|
||||
|
|
Loading…
Add table
Reference in a new issue