From 85fac4137c55701a22389a36ab2e6bbe7000a024 Mon Sep 17 00:00:00 2001 From: nubDotDev Date: Sun, 17 Aug 2025 14:36:42 -0400 Subject: [PATCH 1/3] Give LabeledDot a buffer and improve radius calculation --- manim/mobject/geometry/arc.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/manim/mobject/geometry/arc.py b/manim/mobject/geometry/arc.py index 8b9e832a5b..a210911ed6 100644 --- a/manim/mobject/geometry/arc.py +++ b/manim/mobject/geometry/arc.py @@ -757,8 +757,9 @@ class LabeledDot(Dot): representing rendered strings like :class:`~.Text` or :class:`~.Tex` can be passed as well. radius - The radius of the :class:`Dot`. If ``None`` (the default), the radius - is calculated based on the size of the ``label``. + The radius of the :class:`Dot`. If provided, the ``buff`` is ignored. + If ``None`` (the default), the radius is calculated based on the size + of the ``label``. Examples -------- @@ -784,6 +785,7 @@ def __init__( self, label: str | SingleStringMathTex | Text | Tex, radius: float | None = None, + buff: float = SMALL_BUFF, **kwargs: Any, ) -> None: if isinstance(label, str): @@ -794,7 +796,9 @@ def __init__( rendered_label = label if radius is None: - radius = 0.1 + max(rendered_label.width, rendered_label.height) / 2 + radius = buff + float( + np.linalg.norm(rendered_label.width, rendered_label.height) / 2 + ) super().__init__(radius=radius, **kwargs) rendered_label.move_to(self.get_center()) self.add(rendered_label) From be9e50469a1d3a5c28f48c52902045e5c7bc5670 Mon Sep 17 00:00:00 2001 From: nubDotDev Date: Sun, 17 Aug 2025 14:37:25 -0400 Subject: [PATCH 2/3] fix norm calculation --- manim/mobject/geometry/arc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manim/mobject/geometry/arc.py b/manim/mobject/geometry/arc.py index a210911ed6..091d87604b 100644 --- a/manim/mobject/geometry/arc.py +++ b/manim/mobject/geometry/arc.py @@ -797,7 +797,7 @@ def __init__( if radius is None: radius = buff + float( - np.linalg.norm(rendered_label.width, rendered_label.height) / 2 + np.linalg.norm([rendered_label.width, rendered_label.height]) / 2 ) super().__init__(radius=radius, **kwargs) rendered_label.move_to(self.get_center()) From 1ff212a105663305f41a344dd29c9dbe1c215f8a Mon Sep 17 00:00:00 2001 From: nubDotDev Date: Sun, 17 Aug 2025 14:41:41 -0400 Subject: [PATCH 3/3] documentation --- manim/mobject/geometry/arc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manim/mobject/geometry/arc.py b/manim/mobject/geometry/arc.py index 091d87604b..0513809cbb 100644 --- a/manim/mobject/geometry/arc.py +++ b/manim/mobject/geometry/arc.py @@ -759,7 +759,7 @@ class LabeledDot(Dot): radius The radius of the :class:`Dot`. If provided, the ``buff`` is ignored. If ``None`` (the default), the radius is calculated based on the size - of the ``label``. + of the ``label`` and the ``buff``. Examples --------