Improved VMobject.match_style method to handle submobjects in a smarter way

This commit is contained in:
Grant Sanderson
2018-01-23 13:41:43 -08:00
parent 64b5399bc5
commit bf5480c33b

View File

@ -92,9 +92,15 @@ class VMobject(Mobject):
fill_opacity = vmobject.get_fill_opacity(),
family = False
)
#TODO: This behaviro may not be optimal when submobject
#lists dont' have the same length
for sm1, sm2 in zip(self.submobjects, vmobject.submobjects):
#Does its best to match up submobject lists, and
#match styles accordingly
submobs1, submobs2 = self.submobjects, vmobject.submobjects
if len(submobs1) == 0:
return
elif len(submobs2) == 0:
submobs2 = [vmobject]
for sm1, sm2 in zip(*make_even(submobs1, submobs2)):
sm1.match_style(sm2)
return