mirror of
https://github.com/lalbornoz/roar.git
synced 2024-11-23 07:36:37 +00:00
MiRCARTToolLine.py: correctly cache colours on first click.
This commit is contained in:
parent
f20174037c
commit
2330eb8c69
@ -27,7 +27,7 @@ from MiRCARTTool import MiRCARTTool
|
|||||||
class MiRCARTToolLine(MiRCARTTool):
|
class MiRCARTToolLine(MiRCARTTool):
|
||||||
"""XXX"""
|
"""XXX"""
|
||||||
name = "Line"
|
name = "Line"
|
||||||
toolOriginPoint = toolState = None
|
toolColours = toolOriginPoint = toolState = None
|
||||||
|
|
||||||
TS_NONE = 0
|
TS_NONE = 0
|
||||||
TS_ORIGIN = 1
|
TS_ORIGIN = 1
|
||||||
@ -80,21 +80,25 @@ class MiRCARTToolLine(MiRCARTTool):
|
|||||||
brushColours[1] = brushColours[0]
|
brushColours[1] = brushColours[0]
|
||||||
if self.toolState == self.TS_NONE:
|
if self.toolState == self.TS_NONE:
|
||||||
if isLeftDown or isRightDown:
|
if isLeftDown or isRightDown:
|
||||||
|
self.toolColours = brushColours
|
||||||
self.toolOriginPoint = list(atPoint)
|
self.toolOriginPoint = list(atPoint)
|
||||||
self.toolState = self.TS_ORIGIN
|
self.toolState = self.TS_ORIGIN
|
||||||
dispatchFn(eventDc, True, [atPoint, brushColours, 0, " "])
|
dispatchFn(eventDc, True, [atPoint, brushColours, 0, " "])
|
||||||
elif self.toolState == self.TS_ORIGIN:
|
elif self.toolState == self.TS_ORIGIN:
|
||||||
targetPoint = list(atPoint)
|
targetPoint = list(atPoint)
|
||||||
originPoint = self.toolOriginPoint
|
originPoint = self.toolOriginPoint
|
||||||
self._getLine(brushColours, brushSize, \
|
self._getLine(self.toolColours, brushSize, \
|
||||||
eventDc, isLeftDown or isRightDown, \
|
eventDc, isLeftDown or isRightDown, \
|
||||||
originPoint, targetPoint, dispatchFn)
|
originPoint, targetPoint, dispatchFn)
|
||||||
if isLeftDown or isRightDown:
|
if isLeftDown or isRightDown:
|
||||||
|
self.toolColours = None
|
||||||
|
self.toolOriginPoint = None
|
||||||
self.toolState = self.TS_NONE
|
self.toolState = self.TS_NONE
|
||||||
|
|
||||||
# __init__(self, *args): initialisation method
|
# __init__(self, *args): initialisation method
|
||||||
def __init__(self, *args):
|
def __init__(self, *args):
|
||||||
super().__init__(*args)
|
super().__init__(*args)
|
||||||
|
self.toolColours = None
|
||||||
self.toolOriginPoint = None
|
self.toolOriginPoint = None
|
||||||
self.toolState = self.TS_NONE
|
self.toolState = self.TS_NONE
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user