libroar/RoarCanvasWindow.py:onKeyboardInput(): simulate LMB & advance to the right w/ space key except w/ Text tool.

This commit is contained in:
Lucio Andrés Illanes Albornoz 2019-09-16 17:31:17 +02:00
parent e21bb17e51
commit 09c0df13cf

View File

@ -164,7 +164,7 @@ class RoarCanvasWindow(GuiWindow):
def onKeyboardInput(self, event):
keyCode, keyModifiers = event.GetKeyCode(), event.GetModifiers()
viewRect = self.GetViewStart(); eventDc = self.backend.getDeviceContext(self.GetClientSize(), self, viewRect);
if (keyCode == wx.WXK_PAUSE) \
if (keyCode == wx.WXK_PAUSE) \
and (keyModifiers == wx.MOD_SHIFT):
import pdb; pdb.set_trace()
elif keyCode in (wx.WXK_DOWN, wx.WXK_LEFT, wx.WXK_RIGHT, wx.WXK_UP):
@ -190,6 +190,17 @@ class RoarCanvasWindow(GuiWindow):
self.brushPos = [self.brushPos[0], self.canvas.size[1] - 1]
self.commands.update(cellPos=self.brushPos)
self.applyTool(eventDc, True, None, None, None, self.brushPos, False, False, False, self.commands.currentTool, viewRect)
elif (chr(event.GetUnicodeKey()) == " ") \
and (self.commands.currentTool.__class__ != ToolText):
if not self.applyTool(eventDc, True, None, None, event.GetModifiers(), self.brushPos, False, True, False, self.commands.currentTool, viewRect):
event.Skip()
else:
if self.brushPos[0] < (self.canvas.size[0] - 1):
self.brushPos = [self.brushPos[0] + 1, self.brushPos[1]]
else:
self.brushPos = [0, self.brushPos[1]]
self.commands.update(cellPos=self.brushPos)
self.applyTool(eventDc, True, None, None, None, self.brushPos, False, False, False, self.commands.currentTool, viewRect)
else:
if not self.applyTool(eventDc, False, chr(event.GetUnicodeKey()), keyCode, keyModifiers, None, None, None, None, self.commands.currentTool, viewRect):
event.Skip()