Move check_interaction to Cross clas
This commit is contained in:
parent
b8a3e44f7c
commit
b3949e25f2
4
main.py
4
main.py
@ -41,7 +41,7 @@ class Cross_painter(Widget):
|
|||||||
def on_touch_down(self,touch):
|
def on_touch_down(self,touch):
|
||||||
# create new cross
|
# create new cross
|
||||||
if touch.button=="right":
|
if touch.button=="right":
|
||||||
if self.check_add((touch.x,touch.y)):
|
if self.check_add(Point(touch.x,touch.y)):
|
||||||
new=Cross(touch.x,touch.y)
|
new=Cross(touch.x,touch.y)
|
||||||
with self.canvas:
|
with self.canvas:
|
||||||
new.draw()
|
new.draw()
|
||||||
@ -91,7 +91,7 @@ class Cross_painter(Widget):
|
|||||||
# check that a cross can be added at position
|
# check that a cross can be added at position
|
||||||
def check_add(self,pos):
|
def check_add(self,pos):
|
||||||
for cross in self.crosses:
|
for cross in self.crosses:
|
||||||
if self.check_interaction(pos,cross)==False:
|
if cross.check_interaction(pos)==False:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user