Skip to content

Commit

Permalink
Merge pull request #141 from chris-greening/fix-screen-size
Browse files Browse the repository at this point in the history
Fix screen size draw
  • Loading branch information
chris-greening authored Apr 7, 2023
2 parents edc9a51 + 35ed59b commit 6e2d40f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setuptools.setup(
name="spyrograph",
version="0.25.0",
version="0.25.1",
author="Chris Greening",
author_email="chris@christophergreening.com",
description="Library for drawing spirographs in Python",
Expand Down
10 changes: 9 additions & 1 deletion spyrograph/core/_cycloid.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def animate(
thetas: List[Number] = None,
theta_start: Number = None, theta_stop: Number = None,
theta_step: Number = None, origin: Tuple[Number, Number] = (0, 0),
screen_size: Tuple[Number, Number] = (1000, 1000),
screen_size: Tuple[Number, Number] = None,
screen_color: str = "white", exit_on_click: bool = False,
color: str = "black", width: Number = 1,
frame_pause: Number = 0.1, screen: "turtle.Screen" = None,
Expand Down Expand Up @@ -137,6 +137,14 @@ def animate(
R, r, thetas, theta_start,
theta_stop, theta_step, origin
)
min_x = min(shapes_arr, key=lambda x: x.min_x).min_x
max_x = max(shapes_arr, key=lambda x: x.max_x).max_x
min_y = min(shapes_arr, key=lambda x: x.min_y).min_y
max_y = max(shapes_arr, key=lambda x: x.max_y).max_y
screen_size = (
max_x - min_x + padding,
max_y - min_y + padding
)
_draw_animation(
shapes_arr=shapes_arr, screen_size=screen_size,
screen_color=screen_color, exit_on_click=exit_on_click, color=color,
Expand Down
8 changes: 8 additions & 0 deletions spyrograph/core/_trochoid.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,14 @@ def animate(
R, r, d, thetas, theta_start,
theta_stop, theta_step, origin
)
min_x = min(shapes_arr, key=lambda x: x.min_x).min_x
max_x = max(shapes_arr, key=lambda x: x.max_x).max_x
min_y = min(shapes_arr, key=lambda x: x.min_y).min_y
max_y = max(shapes_arr, key=lambda x: x.max_y).max_y
screen_size = (
max_x - min_x + padding,
max_y - min_y + padding
)
_draw_animation(
shapes_arr=shapes_arr, screen_size=screen_size,
screen_color=screen_color, exit_on_click=exit_on_click, color=color,
Expand Down

0 comments on commit 6e2d40f

Please sign in to comment.