mirror of
https://github.com/3b1b/manim.git
synced 2025-08-01 17:29:06 +08:00
Some bug fixes associated with new copy method
This commit is contained in:
@ -128,6 +128,20 @@ class TexMobject(SVGMobject):
|
||||
if test(tex, part_tex)
|
||||
]
|
||||
|
||||
def copy(self):
|
||||
## TODO, is this the best way?
|
||||
copy_mobject = SVGMobject.copy(self)
|
||||
if hasattr(self, "expression_parts"):
|
||||
pairs = zip(
|
||||
self.submobject_family(),
|
||||
copy_mobject.submobject_family()
|
||||
)
|
||||
for submob, copy_submob in pairs:
|
||||
if submob in self.original_submobjects:
|
||||
index = self.original_submobjects.index(submob)
|
||||
copy_mobject.original_submobjects[index] = copy_submob
|
||||
return copy_mobject
|
||||
|
||||
def get_part_by_tex(self, tex, **kwargs):
|
||||
all_parts = self.get_parts_by_tex(tex, **kwargs)
|
||||
return all_parts[0] if all_parts else None
|
||||
|
@ -200,7 +200,7 @@ class VMobject(Mobject):
|
||||
but will be tracked in a separate special list for when
|
||||
it comes time to display.
|
||||
"""
|
||||
subpath_mobject = VMobject()
|
||||
subpath_mobject = self.copy()##Really helps to be of the same class
|
||||
subpath_mobject.is_subpath = True
|
||||
subpath_mobject.set_points(points)
|
||||
self.add(subpath_mobject)
|
||||
|
Reference in New Issue
Block a user