mirror of
https://github.com/3b1b/manim.git
synced 2025-04-13 09:47:07 +00:00
Fix DecimalNumber.set_value font size issue
This commit is contained in:
parent
45f8ca7643
commit
c531e56a2f
1 changed files with 6 additions and 4 deletions
|
@ -52,7 +52,6 @@ class DecimalNumber(VMobject):
|
||||||
self.edge_to_fix = edge_to_fix
|
self.edge_to_fix = edge_to_fix
|
||||||
self.font_size = font_size
|
self.font_size = font_size
|
||||||
self.text_config = dict(text_config)
|
self.text_config = dict(text_config)
|
||||||
self.text_config["font_size"] = font_size
|
|
||||||
|
|
||||||
super().__init__(
|
super().__init__(
|
||||||
color=color,
|
color=color,
|
||||||
|
@ -80,15 +79,18 @@ class DecimalNumber(VMobject):
|
||||||
submob_templates.append(self.char_to_mob(self.unit))
|
submob_templates.append(self.char_to_mob(self.unit))
|
||||||
|
|
||||||
# Set internals
|
# Set internals
|
||||||
|
font_size = self.get_font_size()
|
||||||
if len(submob_templates) == len(self.submobjects):
|
if len(submob_templates) == len(self.submobjects):
|
||||||
for sm, smt in zip(self.submobjects, submob_templates):
|
for sm, smt in zip(self.submobjects, submob_templates):
|
||||||
sm.become(smt)
|
sm.become(smt)
|
||||||
|
sm.scale(font_size / smt.font_size)
|
||||||
else:
|
else:
|
||||||
self.set_submobjects([smt.copy() for smt in submob_templates])
|
self.set_submobjects([
|
||||||
|
smt.copy().scale(font_size / smt.font_size)
|
||||||
|
for smt in submob_templates
|
||||||
|
])
|
||||||
|
|
||||||
font_size = self.get_font_size()
|
|
||||||
digit_buff = self.digit_buff_per_font_unit * font_size
|
digit_buff = self.digit_buff_per_font_unit * font_size
|
||||||
self.scale(font_size / self.text_config["font_size"])
|
|
||||||
self.arrange(RIGHT, buff=digit_buff, aligned_edge=DOWN)
|
self.arrange(RIGHT, buff=digit_buff, aligned_edge=DOWN)
|
||||||
|
|
||||||
# Handle alignment of special characters
|
# Handle alignment of special characters
|
||||||
|
|
Loading…
Add table
Reference in a new issue