From 72b96b7c771a20ec10f8808884698aee59e8dde5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz?= Date: Mon, 16 Sep 2019 08:45:03 +0200 Subject: [PATCH] libtools/ToolFill.py: honour cell background colour & character on LMB, cell background colour only on RMB. --- libtools/ToolFill.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libtools/ToolFill.py b/libtools/ToolFill.py index 469b472..28b2c1d 100644 --- a/libtools/ToolFill.py +++ b/libtools/ToolFill.py @@ -12,14 +12,12 @@ class ToolFill(Tool): # # onMouseEvent(self, brushColours, brushSize, canvas, dispatchFn, eventDc, keyModifiers, mapPoint, mouseDragging, mouseLeftDown, mouseRightDown, viewRect) def onMouseEvent(self, brushColours, brushSize, canvas, dispatchFn, eventDc, keyModifiers, mapPoint, mouseDragging, mouseLeftDown, mouseRightDown, viewRect): - dirty, pointsDone, pointStack, testColour, = False, [], [list(mapPoint)], canvas.map[mapPoint[1]][mapPoint[0]][0:2] + dirty, pointsDone, pointStack, testChar, testColour = False, [], [list(mapPoint)], canvas.map[mapPoint[1]][mapPoint[0]][3], canvas.map[mapPoint[1]][mapPoint[0]][0:2] if mouseLeftDown or mouseRightDown: - if mouseRightDown: - brushColours = [brushColours[1], brushColours[0]] while len(pointStack) > 0: point = pointStack.pop() pointCell = canvas.map[point[1]][point[0]] - if (pointCell[0:2] == testColour) \ + if ((pointCell[1] == testColour[1]) and ((pointCell[3] == testChar) or mouseRightDown)) \ or ((pointCell[3] == " ") and (pointCell[1] == testColour[1])): if not point in pointsDone: if not dirty: