From a4a9c9a2d549ff06a1cd1908a608eb93e4cb33a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz?= Date: Thu, 12 Sep 2019 20:09:11 +0200 Subject: [PATCH] libtools/ToolSelectMove.py: exclude sub-cells of both of {select,src}Rect from being cleared. libtools/ToolSelect.py: minor cleanup. --- libtools/ToolSelect.py | 2 +- libtools/ToolSelectMove.py | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/libtools/ToolSelect.py b/libtools/ToolSelect.py index 73dde94..932e6fe 100644 --- a/libtools/ToolSelect.py +++ b/libtools/ToolSelect.py @@ -60,7 +60,7 @@ class ToolSelect(Tool): self.targetRect[0][0], self.targetRect[1][0] = self.targetRect[1][0], self.targetRect[0][0] if self.targetRect[0][1] > self.targetRect[1][1]: self.targetRect[0][1], self.targetRect[1][1] = self.targetRect[1][1], self.targetRect[0][1] - self.srcRect, self.lastAtPoint, self.toolSelectMap, self.toolState = self.targetRect[0], list(mapPoint), [], self.TS_SELECT + self.lastAtPoint, self.srcRect, self.toolSelectMap, self.toolState = list(mapPoint), self.targetRect, [], self.TS_SELECT for numRow in range((self.targetRect[1][1] - self.targetRect[0][1]) + 1): self.toolSelectMap.append([]) for numCol in range((self.targetRect[1][0] - self.targetRect[0][0]) + 1): diff --git a/libtools/ToolSelectMove.py b/libtools/ToolSelectMove.py index 2ba395f..10058b3 100644 --- a/libtools/ToolSelectMove.py +++ b/libtools/ToolSelectMove.py @@ -13,9 +13,12 @@ class ToolSelectMove(ToolSelect): # onSelectEvent(self, disp, dispatchFn, eventDc, isCursor, newToolRect, selectRect, viewRect) def onSelectEvent(self, disp, dispatchFn, eventDc, isCursor, newToolRect, selectRect, viewRect): dirty = False - for numRow in range(len(self.toolSelectMap)): - for numCol in range(len(self.toolSelectMap[numRow])): - dispatchFn(eventDc, isCursor, [self.srcRect[0] + numCol, self.srcRect[1] + numRow, 1, 1, 0, " "], viewRect) + for numRow in range(self.srcRect[0][1], self.srcRect[1][1]): + for numCol in range(self.srcRect[0][0], self.srcRect[1][0]): + if ((numCol < selectRect[0][0]) or (numCol > selectRect[1][0])) \ + or ((numRow < selectRect[0][1]) or (numRow > selectRect[1][1])): + dirty = False if isCursor else True + dispatchFn(eventDc, isCursor, [numCol, numRow, 1, 1, 0, " "], viewRect) for numRow in range(len(self.toolSelectMap)): for numCol in range(len(self.toolSelectMap[numRow])): cellOld = self.toolSelectMap[numRow][numCol]