Set shape from command

This commit is contained in:
2024-02-21 15:30:52 -05:00
parent 955aa8f10a
commit b1d56fea04
2 changed files with 22 additions and 3 deletions

View File

@ -35,6 +35,9 @@ class Painter(Widget):
# list of particles
self.particles=[]
# shape of particle to add next
self.shape=Cross
# underlying lattice
self.lattice=None
@ -229,8 +232,7 @@ class Painter(Widget):
# create new particle
if touch.button=="right":
new=Cross(touchx,touchy)
#new=Disk(touchx,touchy)
new=self.shape(touchx,touchy)
# snap to lattice
if self.lattice!=None:
new.move(self.lattice.nearest_delta(new.elements[0].pos))