mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
Fixed the bug with negative 0 displaying
This commit is contained in:
parent
0c30d31dff
commit
eb149bef2e
1 changed files with 4 additions and 1 deletions
|
@ -15,6 +15,9 @@ class DecimalNumber(VMobject):
|
|||
def __init__(self, number, **kwargs):
|
||||
digest_config(self, kwargs, locals())
|
||||
num_string = '%.*f'%(self.num_decimal_points, number)
|
||||
negative_zero_string = "-%.*f"%(self.num_decimal_points, 0.)
|
||||
if num_string == negative_zero_string:
|
||||
num_string = num_string[1:]
|
||||
VMobject.__init__(self, *[
|
||||
TexMobject(char)
|
||||
for char in num_string
|
||||
|
@ -27,7 +30,7 @@ class DecimalNumber(VMobject):
|
|||
buff = self.digit_to_digit_buff,
|
||||
aligned_edge = DOWN
|
||||
)
|
||||
if number < 0:
|
||||
if num_string.startswith("-"):
|
||||
minus = self.submobjects[0]
|
||||
minus.next_to(
|
||||
self.submobjects[1], LEFT,
|
||||
|
|
Loading…
Add table
Reference in a new issue