From 0fe82c1006069105c49e2f17a41f147b1b41f7bf Mon Sep 17 00:00:00 2001 From: Ian Jauslin Date: Wed, 20 Oct 2021 11:07:45 -0400 Subject: [PATCH] change selected to undermouse --- cross.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/cross.py b/cross.py index b148536..29aeee0 100644 --- a/cross.py +++ b/cross.py @@ -220,8 +220,8 @@ class Cross_painter(Widget): # list of crosses self.crosses=[] - # selected cross - self.selected=None + # cross under mouse + self.undermouse=None # app is used to share information between widgets self.app=app @@ -232,7 +232,7 @@ class Cross_painter(Widget): def reset(self): self.crosses=[] - self.selected=None + self.undermouse=None self.draw() @@ -260,13 +260,13 @@ class Cross_painter(Widget): # select cross if touch.button=="left": # unselect - if self.selected!=None: - self.selected.selected=False + if self.undermouse!=None: + self.undermouse.selected=False - # select cross under touch - self.selected=self.find_cross(Point(touch.x/Cross.size,touch.y/Cross.size)) - if self.selected!=None: - self.selected.selected=True + # find cross under touch + self.undermouse=self.find_cross(Point(touch.x/Cross.size,touch.y/Cross.size)) + if self.undermouse!=None: + self.undermouse.selected=True self.draw() @@ -274,8 +274,8 @@ class Cross_painter(Widget): def on_touch_move(self,touch): if self.collide_point(*touch.pos): # only move on left click - if touch.button=="left" and self.selected!=None: - self.selected.pos=self.check_move(Point(touch.x/Cross.size,touch.y/Cross.size),self.selected) + if touch.button=="left" and self.undermouse!=None: + self.undermouse.pos=self.check_move(Point(touch.x/Cross.size,touch.y/Cross.size),self.undermouse) # redraw self.draw()