From 0843b7d33041578493fa87e0c49059acdbc34561 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz?= Date: Mon, 23 Sep 2019 19:19:43 +0200 Subject: [PATCH] Allow cancelling & setting object selection w/ . --- libtools/ToolObject.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libtools/ToolObject.py b/libtools/ToolObject.py index da81524..012fe76 100644 --- a/libtools/ToolObject.py +++ b/libtools/ToolObject.py @@ -101,6 +101,14 @@ class ToolObject(Tool): def getRegion(self, canvas): return self.objectMap + def onKeyboardEvent(self, atPoint, brushColours, brushPos, brushSize, canvas, dispatchFn, eventDc, keyChar, keyCode, keyModifiers, mapPoint): + rc, dirty = False, False + if ord(keyChar) == wx.WXK_ESCAPE: + dirty = self.onSelectEvent(canvas, (0, 0), dispatchFn, eventDc, False, keyModifiers, self.targetRect.copy(), self.targetRect) + self._drawSelectRect(self.targetRect, dispatchFn, eventDc) + self.objectMap, self.objectSize, self.targetRect, self.toolState = None, None, None, self.TS_NONE + return rc, dirty + def onMouseEvent(self, atPoint, brushColours, brushPos, brushSize, canvas, dispatchFn, eventDc, keyModifiers, mapPoint, mouseDragging, mouseLeftDown, mouseRightDown): dirty = False if self.toolState == self.TS_NONE: