diff --git a/cross.py b/cross.py index ae9a170..c912070 100644 --- a/cross.py +++ b/cross.py @@ -278,18 +278,18 @@ class Cross_painter(Widget): # only respond to touch in area if self.collide_point(*touch.pos): - # unselect - if touch.button!="left" or self.modifiers!=['s']: - for sel in self.selected: - sel.selected=False - self.selected=[] - # create new cross if touch.button=="right": if self.check_interaction_any(Point(touch.x/Cross.size,touch.y/Cross.size),None): new=Cross(touch.x/Cross.size,touch.y/Cross.size) # add to list self.crosses.append(new) + + # unselect all crosses + for sel in self.selected: + sel.selected=False + self.selected=[] + self.draw() # select cross @@ -299,6 +299,13 @@ class Cross_painter(Widget): # find cross under touch self.undermouse=self.find_cross(Point(touch.x/Cross.size,touch.y/Cross.size)) + if self.undermouse==None or not self.undermouse in self.selected: + # unselect all crosses + for sel in self.selected: + sel.selected=False + self.selected=[] + + # shift-click elif self.modifiers==['s']: clicked=self.find_cross(Point(touch.x/Cross.size,touch.y/Cross.size))