mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Tweak type hints in matrix.py
This commit is contained in:
parent
c96cdf43a1
commit
0433cd727c
1 changed files with 9 additions and 3 deletions
|
@ -106,10 +106,16 @@ class Matrix(VMobject):
|
||||||
self.add_background_rectangle()
|
self.add_background_rectangle()
|
||||||
|
|
||||||
|
|
||||||
def element_to_mobject(self, element: str | float, **config) -> Tex:
|
def element_to_mobject(self, element: str | float | VMobject, **config) -> VMobject:
|
||||||
|
if isinstance(element, VMobject):
|
||||||
|
return element
|
||||||
return Tex(str(element), **config)
|
return Tex(str(element), **config)
|
||||||
|
|
||||||
def matrix_to_mob_matrix(self, matrix: npt.ArrayLike, **config) -> list[list[VMobject]]:
|
def matrix_to_mob_matrix(
|
||||||
|
self,
|
||||||
|
matrix: Sequence[Sequence[str | float | VMobject]],
|
||||||
|
**config
|
||||||
|
) -> list[list[VMobject]]:
|
||||||
return [
|
return [
|
||||||
[
|
[
|
||||||
self.element_to_mobject(item, **config)
|
self.element_to_mobject(item, **config)
|
||||||
|
@ -120,7 +126,7 @@ class Matrix(VMobject):
|
||||||
|
|
||||||
def organize_mob_matrix(
|
def organize_mob_matrix(
|
||||||
self,
|
self,
|
||||||
matrix: list[list[Mobject]],
|
matrix: list[list[VMobject]],
|
||||||
v_buff: float,
|
v_buff: float,
|
||||||
h_buff: float,
|
h_buff: float,
|
||||||
aligned_corner: Vect3,
|
aligned_corner: Vect3,
|
||||||
|
|
Loading…
Add table
Reference in a new issue