Skip to content

Commit

Permalink
Fix rectangle grid properties (#3082) (#3513)
Browse files Browse the repository at this point in the history
* Import  for both vertical and horizontal gridlines in

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Tristan Schulz <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 12, 2023
1 parent 9938bf5 commit d390978
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions manim/mobject/geometry/polygram.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,12 +619,16 @@ def __init__(
super().__init__(UR, UL, DL, DR, color=color, **kwargs)
self.stretch_to_fit_width(width)
self.stretch_to_fit_height(height)

v = self.get_vertices()
self.grid_lines = VGroup()

if grid_xstep is not None:
if grid_xstep or grid_ystep:
from manim.mobject.geometry.line import Line

v = self.get_vertices()

if grid_xstep:
grid_xstep = abs(grid_xstep)
count = int(width / grid_xstep)
grid = VGroup(
Expand All @@ -638,7 +642,8 @@ def __init__(
)
)
self.grid_lines.add(grid)
if grid_ystep is not None:

if grid_ystep:
grid_ystep = abs(grid_ystep)
count = int(height / grid_ystep)
grid = VGroup(
Expand Down

0 comments on commit d390978

Please sign in to comment.