@@ -598,8 +598,10 @@ class RectangleExample(Scene):
598
598
def construct(self):
599
599
rect1 = Rectangle(width=4.0, height=2.0, grid_xstep=1.0, grid_ystep=0.5)
600
600
rect2 = Rectangle(width=1.0, height=4.0)
601
+ rect3 = Rectangle(width=2.0, height=2.0, grid_xstep=1.0, grid_ystep=1.0)
602
+ rect3.grid_lines.set_stroke(width=1)
601
603
602
- rects = Group(rect1,rect2).arrange(buff=1)
604
+ rects = Group(rect1, rect2, rect3 ).arrange(buff=1)
603
605
self.add(rects)
604
606
"""
605
607
@@ -618,6 +620,8 @@ def __init__(
618
620
self .stretch_to_fit_width (width )
619
621
self .stretch_to_fit_height (height )
620
622
v = self .get_vertices ()
623
+ self .grid_lines = VGroup ()
624
+
621
625
if grid_xstep is not None :
622
626
from manim .mobject .geometry .line import Line
623
627
@@ -633,7 +637,7 @@ def __init__(
633
637
for i in range (1 , count )
634
638
)
635
639
)
636
- self .add (grid )
640
+ self .grid_lines . add (grid )
637
641
if grid_ystep is not None :
638
642
grid_ystep = abs (grid_ystep )
639
643
count = int (height / grid_ystep )
@@ -647,7 +651,10 @@ def __init__(
647
651
for i in range (1 , count )
648
652
)
649
653
)
650
- self .add (grid )
654
+ self .grid_lines .add (grid )
655
+
656
+ if self .grid_lines :
657
+ self .add (self .grid_lines )
651
658
652
659
653
660
class Square (Rectangle ):
0 commit comments