From a702a4a99180f19241ea2ee1a229ad6fa8eae724 Mon Sep 17 00:00:00 2001 From: Ian Jauslin Date: Wed, 20 Oct 2021 21:02:51 -0400 Subject: [PATCH] Set undermouse even when selecting --- cross.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/cross.py b/cross.py index c912070..86b3220 100644 --- a/cross.py +++ b/cross.py @@ -294,11 +294,11 @@ class Cross_painter(Widget): # select cross if touch.button=="left": + # find cross under touch + self.undermouse=self.find_cross(Point(touch.x/Cross.size,touch.y/Cross.size)) + # no modifiers if self.modifiers==[]: - # 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: @@ -308,16 +308,15 @@ class Cross_painter(Widget): # shift-click elif self.modifiers==['s']: - clicked=self.find_cross(Point(touch.x/Cross.size,touch.y/Cross.size)) - if clicked!=None: - if clicked not in self.selected: - self.selected.append(clicked) - clicked.selected=True + if self.undermouse!=None: + if self.undermouse not in self.selected: + self.selected.append(self.undermouse) + self.undermouse.selected=True else: # remove - self.selected[self.selected.index(clicked)]=self.selected[len(self.selected)-1] + self.selected[self.selected.index(self.undermouse)]=self.selected[len(self.selected)-1] self.selected=self.selected[:len(self.selected)-1] - clicked.selected=False + self.undermouse.selected=False self.draw()