libtools/ToolSelectMove.py: exclude sub-cells of both of {select,src}Rect from being cleared.

libtools/ToolSelect.py: minor cleanup.
This commit is contained in:
Lucio Andrés Illanes Albornoz 2019-09-12 20:09:11 +02:00
parent ec515d4ed4
commit a4a9c9a2d5
2 changed files with 7 additions and 4 deletions

View File

@ -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):

View File

@ -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]