Reformat defaults for n_rows and n_cols in Mobject.arrange_in_grid

This commit is contained in:
Grant Sanderson 2024-01-18 11:13:12 -06:00
parent 855ef9be8d
commit 8179ba88d0

View file

@ -495,12 +495,11 @@ class Mobject(object):
fill_rows_first: bool = True
) -> Self:
submobs = self.submobjects
if n_rows is None and n_cols is None:
n_rows = int(np.sqrt(len(submobs)))
n_submobs = len(submobs)
if n_rows is None:
n_rows = len(submobs) // n_cols
n_rows = int(np.sqrt(n_submobs)) if n_cols is None else n_submobs // n_cols
if n_cols is None:
n_cols = len(submobs) // n_rows
n_cols = n_submobs // n_rows
if buff is not None:
h_buff = buff