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