Skip to content

Commit

Permalink
fix(lib): force float
Browse files Browse the repository at this point in the history
  • Loading branch information
jeertmans committed Dec 10, 2024
1 parent 1f5b6b9 commit ea5467d
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions manim_slides/slide/manimlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,27 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:

@property
def _frame_height(self) -> float:
return self.camera.frame.get_height() # type: ignore
return float(self.camera.get_frame_height())

@property
def _frame_width(self) -> float:
return self.camera.frame.get_width() # type: ignore
return float(self.camera.get_frame_width())

@property
def _background_color(self) -> str:
return self.camera_config["background_color"].hex # type: ignore
rgba = self.camera.background_rgba
r = int(255 * rgba[0])
g = int(255 * rgba[1])
b = int(255 * rgba[2])
if rgba[3] == 1.0:
return f"#{r:02x}{g:02x}{b:02x}"

a = int(255 * rgba[3])
return f"#{r:02x}{g:02x}{b:02x}{a:02x}"

Check warning on line 41 in manim_slides/slide/manimlib.py

View check run for this annotation

Codecov / codecov/patch

manim_slides/slide/manimlib.py#L40-L41

Added lines #L40 - L41 were not covered by tests

@property
def _resolution(self) -> tuple[int, int]:
return self.camera_config["pixel_width"], self.camera_config["pixel_height"]
return self.camera.get_pixel_width(), self.camera.get_pixel_height()

@property
def _partial_movie_files(self) -> list[Path]:
Expand Down

0 comments on commit ea5467d

Please sign in to comment.