ManimCommunity / ManimCommunity/manim
DecimalNumber() updater font size dependent on placement when using unit="°"
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 40.9k
- Forks
- 3.1k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 25
Description
## Description of bug / unexpected behavior
The font size of a `DecimalNumber()` object changes when updated when it is placed using `.next_to()` to an object which itself was placed relative to the top-left corner using `to_edge(UL)`.
## Expected behavior
The font size of the `DecimalNumber()` should not change when its value is updated.
## How to reproduce the issue
Code for reproducing the problem
```py
class decupdate2(Scene):
def construct(self):
x = ValueTracker(2)
theta = MathTex(r"\theta =").to_corner(UL)
theta2val = DecimalNumber(
0, num_decimal_places=1, group_with_commas=False, unit="°", edge_to_fix=LEFT
).next_to(theta, RIGHT)
def theta2Updater(mobj):
mobj.set_value(np.arctan2(3,x.get_value())*180/PI)
theta2val.add_updater(theta2Updater)
self.add(theta,theta2val)
self.wait()
self.play(x.animate.set_value(6),run_time=3)
self.wait()
```
Similar code - only difference is the placement of the object next to the DecimalNumber()
```py
class decupdate3(Scene):
def construct(self):
x = ValueTracker(2)
theta = MathTex(r"\theta =").to_edge(LEFT)
theta2val = DecimalNumber(
0, num_decimal_places=1, group_with_commas=False, unit="°", edge_to_fix=LEFT
).next_to(theta, RIGHT)
def theta2Updater(mobj):
mobj.set_value(np.arctan2(3,x.get_value())*180/PI)
theta2val.add_updater(theta2Updater)
self.add(theta,theta2val)
self.wait()
self.play(x.animate.set_value(6),run_time=3)
self.wait()
```
## Additional media files
Images/GIFs
With the wrong scaling:

Second code without wrong scaling

## System specifications
System Details
- OS: Windows 10 and Manimator on Discord
- RAM: enough
- Python version: 3.9.8 and Manimator on Discord
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the two supplied Scene examples and comparing DecimalNumber() behavior when positioned with next_to() after to_corner(UL) versus to_edge(LEFT). Trace the DecimalNumber() set_value updater path alongside placement and edge_to_fix=LEFT. Done means updating the value no longer changes its font size in the reproduced placement.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100