From 309e8cf089ff50effe7872067b9a9cf701f20bcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz?= Date: Tue, 10 Sep 2019 12:20:23 +0200 Subject: [PATCH] libtools/ToolText.py:onKeyboardEvent(): correctly return (rc, dirty). --- libtools/ToolText.py | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/libtools/ToolText.py b/libtools/ToolText.py index 5c21311..58ad948 100644 --- a/libtools/ToolText.py +++ b/libtools/ToolText.py @@ -13,22 +13,20 @@ class ToolText(Tool): # # onKeyboardEvent(self, brushColours, brushSize, dispatchFn, eventDc, keyChar, keyModifiers, mapPoint, viewRect) def onKeyboardEvent(self, brushColours, brushSize, canvas, dispatchFn, eventDc, keyChar, keyModifiers, mapPoint, viewRect): - dirty = False - if not keyModifiers in (wx.MOD_NONE, wx.MOD_SHIFT): - return False - else: + if keyModifiers in (wx.MOD_NONE, wx.MOD_SHIFT): + rc, dirty = True, True if self.textPos == None: self.textPos = list(mapPoint) - if not dirty: - dirty = True - dispatchFn(eventDc, False, [*self.textPos, *brushColours, 0, keyChar], viewRect) - if self.textPos[0] < (canvas.size[0] - 1): - self.textPos[0] += 1 - elif self.textPos[1] < (canvas.size[1] - 1): - self.textPos[0] = 0; self.textPos[1] += 1; + dispatchFn(eventDc, False, [*self.textPos, *brushColours, 0, keyChar], viewRect) + if self.textPos[0] < (canvas.size[0] - 1): + self.textPos[0] += 1 + elif self.textPos[1] < (canvas.size[1] - 1): + self.textPos[0] = 0; self.textPos[1] += 1; + else: + self.textPos = [0, 0] else: - self.textPos = [0, 0] - return True, dirty + rc, dirty = False, False + return rc, dirty # # onMouseEvent(self, brushColours, brushSize, dispatchFn, eventDc, mapPoint, mouseDragging, mouseLeftDown, mouseRightDown, viewRect)