mirror of
https://github.com/lalbornoz/roar.git
synced 2024-12-22 20:36:37 +00:00
Honour RTL flow in text tool.
libtools/ToolText.py:rtlRegEx: added. libtools/ToolText.py:onKeyboardEvent(): move backwards given RTL keyChar. assets/text/TODO: updated.
This commit is contained in:
parent
f2a19e0bf3
commit
e6bdc52af2
@ -22,8 +22,8 @@ High-priority list:
|
||||
Queue:
|
||||
1) scrolling bug: start @ top, down key til cursor below visible canvas, scroll down, cursor gone GRRRR
|
||||
2) scrolling bug: scroll down, apply operator to entire canvas, scroll up
|
||||
3) text tool: a) honour RTL text flow b) pasting text
|
||||
4) select-related {re,un}do bugs
|
||||
3) select-related {re,un}do bugs
|
||||
4) text tool: pasting text
|
||||
5) clone selection lag
|
||||
|
||||
vim:ff=dos tw=0
|
||||
|
@ -5,10 +5,11 @@
|
||||
#
|
||||
|
||||
from Tool import Tool
|
||||
import string, wx
|
||||
import re, string, wx
|
||||
|
||||
class ToolText(Tool):
|
||||
name = "Text"
|
||||
rtlRegEx = r'^[\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC]+$'
|
||||
|
||||
#
|
||||
# onKeyboardEvent(self, atPoint, brushColours, brushPos, brushSize, canvas, dispatchFn, eventDc, keyChar, keyCode, keyModifiers, mapPoint, viewRect)
|
||||
@ -32,12 +33,20 @@ class ToolText(Tool):
|
||||
and ((ord(keyChar) >= 32) if ord(keyChar) < 127 else True) \
|
||||
and (keyModifiers in (wx.MOD_NONE, wx.MOD_SHIFT)):
|
||||
dispatchFn(eventDc, False, [*brushPos, *brushColours, 0, keyChar], viewRect);
|
||||
if brushPos[0] < (canvas.size[0] - 1):
|
||||
brushPos[0] += 1
|
||||
elif brushPos[1] < (canvas.size[1] - 1):
|
||||
brushPos[0], brushPos[1] = 0, brushPos[1] + 1
|
||||
if not re.match(self.rtlRegEx, keyChar):
|
||||
if brushPos[0] < (canvas.size[0] - 1):
|
||||
brushPos[0] += 1
|
||||
elif brushPos[1] < (canvas.size[1] - 1):
|
||||
brushPos[0], brushPos[1] = 0, brushPos[1] + 1
|
||||
else:
|
||||
brushPos[0], brushPos[1] = 0, 0
|
||||
else:
|
||||
brushPos[0], brushPos[1] = 0, 0
|
||||
if brushPos[0] > 0:
|
||||
brushPos[0] -= 1
|
||||
elif brushPos[1] > 0:
|
||||
brushPos[0], brushPos[1] = canvas.size[0] - 1, brushPos[1] - 1
|
||||
else:
|
||||
brushPos[0], brushPos[1] = canvas.size[0] - 1, canvas.size[1] - 1
|
||||
dispatchFn(eventDc, True, [*brushPos, *brushColours, 0, "_"], viewRect)
|
||||
rc, dirty = True, True
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user