The animation engine for agents: blazingly fast math and 3D videos with Manim's Python API, on a Rust GPU core.
Python
Add get_height beside get_width
japbcoelho166e1a275cce
diff --git a/docs/content/changelog.md b/docs/content/changelog.mdindex 3c3b09b8..d1129190 100644--- a/docs/content/changelog.md+++ b/docs/content/changelog.md@@ -24,6 +24,7 @@ The notable changes to ManimGX, release by release. The format follows- Credit Academa and the creators in the README.- Add Manim CE's `partial_bezier_points`, `subdivide_bezier`, `bezier_remap`, `integer_interpolate`, `is_closed` and `get_smooth_cubic_bezier_handle_points` to the package.- Add `remove_fixed_in_frame_mobjects` to `ThreeDScene` and `Camera`, Manim CE's undo of `add_fixed_in_frame_mobjects`: the camera moves the mobjects again.+- Add `get_height()`, deprecated in favor of `height`, as `get_width()` is in favor of `width`: Manim CE scenes call both.### Changeddiff --git a/docs/content/user-guide/coming-from-manim-ce.md b/docs/content/user-guide/coming-from-manim-ce.mdindex b2f69d48..87550346 100644--- a/docs/content/user-guide/coming-from-manim-ce.md+++ b/docs/content/user-guide/coming-from-manim-ce.md@@ -51,6 +51,8 @@ works, but your editor marks it deprecated and names the one to use:`square.animate.set_color(m.RED)`.- `arrange_submobjects` is `arrange`, `rotate_about_origin(angle)` is`rotate(angle, about_point=m.ORIGIN)`, and `get_edge_center(m.UP)` is `get_top()`.+- A getter such as `get_width()`, `get_height()` or `get_color()` is its property:+ `width`, `height`, `color`.- `PGroup` is `Group`, and the singular `add_foreground_mobject` is`add_foreground_mobjects`.diff --git a/src/manimgx/mobject.py b/src/manimgx/mobject.pyindex f9af06c0..1d47ff21 100644--- a/src/manimgx/mobject.py+++ b/src/manimgx/mobject.py@@ -2476,6 +2476,15 @@ class Mobject:"""return self.width+ @deprecated("get_height() is height: use it", category=None)+ def get_height(self) -> float:+ """The mobject's [height][manimgx.Mobject.height].++ Returns:+ The height, in scene units.+ """+ return self.height+# ── layout ────────────────────────────────────────────────────────────def center(self) -> Self:"""Move the mobject so the center of its bounding box is at the origin."""diff --git a/tests/unit/test_mobject.py b/tests/unit/test_mobject.pyindex 816c451d..462c5069 100644--- a/tests/unit/test_mobject.py+++ b/tests/unit/test_mobject.py@@ -2841,3 +2841,10 @@ def test_shown_keys_label_their_values_however_added() -> None:assert label.tex_string == keyassert label.get_right()[0] < value.points[:, 0].min()assert not m.VDict([("s", m.Square())])["s"].submobjects+++def test_get_height_is_height_as_get_width_is_width() -> None:+ """Manim CE code reads a mobject's size with both getters."""+ rectangle = m.Rectangle(width=3.0, height=1.25)+ assert rectangle.get_width() == rectangle.width == pytest.approx(3.0)+ assert rectangle.get_height() == rectangle.height == pytest.approx(1.25)