Set color of next particle

This commit is contained in:
Ian Jauslin 2024-02-21 16:49:48 -05:00
parent 0a8a0e3c53
commit ff11c1ce84
1 changed files with 7 additions and 1 deletions

View File

@ -38,6 +38,9 @@ class Painter(Widget):
# shape of particle to add next
self.shape=Cross
# color of particle to add next
self.color=(0,0,1)
# underlying lattice
self.lattice=None
@ -232,7 +235,7 @@ class Painter(Widget):
# create new particle
if touch.button=="right":
new=self.shape(touchx,touchy)
new=self.shape(touchx,touchy,color=self.color)
# snap to lattice
if self.lattice!=None:
new.move(self.lattice.nearest_delta(new.elements[0].pos))
@ -440,6 +443,9 @@ class Painter(Widget):
# set color of selected particles
def set_color(self,color):
# set color for next particles
self.color=color
# set color of selected particles
for particle in self.selected:
particle.color=color
# redraw