mirror of
https://github.com/3b1b/manim.git
synced 2025-04-13 09:47:07 +00:00
Add min_total_width option to DecimalNumber
This commit is contained in:
parent
d5bb28870f
commit
756113d2d3
1 changed files with 4 additions and 0 deletions
|
@ -40,6 +40,7 @@ class DecimalNumber(VMobject):
|
|||
fill_opacity: float = 1.0,
|
||||
fill_border_width: float = 0.5,
|
||||
num_decimal_places: int = 2,
|
||||
min_total_width: Optional[int] = 0,
|
||||
include_sign: bool = False,
|
||||
group_with_commas: bool = True,
|
||||
digit_buff_per_font_unit: float = 0.001,
|
||||
|
@ -54,6 +55,7 @@ class DecimalNumber(VMobject):
|
|||
self.num_decimal_places = num_decimal_places
|
||||
self.include_sign = include_sign
|
||||
self.group_with_commas = group_with_commas
|
||||
self.min_total_width = min_total_width
|
||||
self.digit_buff_per_font_unit = digit_buff_per_font_unit
|
||||
self.show_ellipsis = show_ellipsis
|
||||
self.unit = unit
|
||||
|
@ -167,6 +169,7 @@ class DecimalNumber(VMobject):
|
|||
"include_sign",
|
||||
"group_with_commas",
|
||||
"num_decimal_places",
|
||||
"min_total_width",
|
||||
]
|
||||
])
|
||||
config.update(kwargs)
|
||||
|
@ -176,6 +179,7 @@ class DecimalNumber(VMobject):
|
|||
config.get("field_name", ""),
|
||||
":",
|
||||
"+" if config["include_sign"] else "",
|
||||
"0" + str(config.get("min_total_width", "")) if config.get("min_total_width") else "",
|
||||
"," if config["group_with_commas"] else "",
|
||||
f".{ndp}f" if ndp > 0 else "d",
|
||||
"}",
|
||||
|
|
Loading…
Add table
Reference in a new issue