Organize get_ancestors from top to bottom

This commit is contained in:
Grant Sanderson 2022-04-27 09:53:23 -07:00
parent 0e45b41fea
commit ec9ed32d78

View file

@ -359,8 +359,9 @@ class Mobject(object):
if p not in excluded: if p not in excluded:
ancestors.append(p) ancestors.append(p)
to_process.append(p) to_process.append(p)
# Remove redundancies while preserving order # Ensure mobjects highest in the hierarchy show up first
ancestors.reverse() ancestors.reverse()
# Remove list redundancies while preserving order
return list(dict.fromkeys(ancestors)) return list(dict.fromkeys(ancestors))
def add(self, *mobjects: Mobject): def add(self, *mobjects: Mobject):