mirror of
https://github.com/lalbornoz/roar.git
synced 2024-11-22 15:26:37 +00:00
MiRCARTToolLine.py: honour brush size.
This commit is contained in:
parent
e157f479ce
commit
3fa377791a
@ -39,8 +39,8 @@ class MiRCARTToolLine(MiRCARTTool):
|
|||||||
def _pointSwap(self, a, b):
|
def _pointSwap(self, a, b):
|
||||||
return [b, a]
|
return [b, a]
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ _getLine(self, brushColours, eventDc, isCursor, originPoint, targetPoint, dispatchFn): XXX
|
# {{{ _getLine(self, brushColours, brushSize, eventDc, isCursor, originPoint, targetPoint, dispatchFn): XXX
|
||||||
def _getLine(self, brushColours, eventDc, isCursor, originPoint, targetPoint, dispatchFn):
|
def _getLine(self, brushColours, brushSize, eventDc, isCursor, originPoint, targetPoint, dispatchFn):
|
||||||
originPoint = originPoint.copy(); targetPoint = targetPoint.copy();
|
originPoint = originPoint.copy(); targetPoint = targetPoint.copy();
|
||||||
pointDelta = self._pointDelta(originPoint, targetPoint)
|
pointDelta = self._pointDelta(originPoint, targetPoint)
|
||||||
lineXSign = 1 if pointDelta[0] > 0 else -1;
|
lineXSign = 1 if pointDelta[0] > 0 else -1;
|
||||||
@ -53,14 +53,15 @@ class MiRCARTToolLine(MiRCARTTool):
|
|||||||
lineXX, lineXY, lineYX, lineYY = 0, lineYSign, lineXSign, 0
|
lineXX, lineXY, lineYX, lineYY = 0, lineYSign, lineXSign, 0
|
||||||
lineD = 2 * pointDelta[1] - pointDelta[0]; lineY = 0;
|
lineD = 2 * pointDelta[1] - pointDelta[0]; lineY = 0;
|
||||||
for lineX in range(pointDelta[0] + 1):
|
for lineX in range(pointDelta[0] + 1):
|
||||||
patch = [[ \
|
for brushStep in range(brushSize[0]):
|
||||||
originPoint[0] + lineX*lineXX + lineY*lineYX, \
|
patch = [[ \
|
||||||
originPoint[1] + lineX*lineXY + lineY*lineYY], \
|
originPoint[0] + lineX*lineXX + lineY*lineYX + brushStep, \
|
||||||
brushColours, 0, " "]
|
originPoint[1] + lineX*lineXY + lineY*lineYY], \
|
||||||
if isCursor:
|
brushColours, 0, " "]
|
||||||
dispatchFn(eventDc, False, patch); dispatchFn(eventDc, True, patch);
|
if isCursor:
|
||||||
else:
|
dispatchFn(eventDc, False, patch); dispatchFn(eventDc, True, patch);
|
||||||
dispatchFn(eventDc, True, patch)
|
else:
|
||||||
|
dispatchFn(eventDc, True, patch)
|
||||||
if lineD > 0:
|
if lineD > 0:
|
||||||
lineD -= pointDelta[0]; lineY += 1;
|
lineD -= pointDelta[0]; lineY += 1;
|
||||||
lineD += pointDelta[1]
|
lineD += pointDelta[1]
|
||||||
@ -84,8 +85,8 @@ class MiRCARTToolLine(MiRCARTTool):
|
|||||||
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, eventDc, \
|
self._getLine(brushColours, brushSize, \
|
||||||
isLeftDown or isRightDown, \
|
eventDc, isLeftDown or isRightDown, \
|
||||||
originPoint, targetPoint, dispatchFn)
|
originPoint, targetPoint, dispatchFn)
|
||||||
if isLeftDown or isRightDown:
|
if isLeftDown or isRightDown:
|
||||||
self.toolState = self.TS_NONE
|
self.toolState = self.TS_NONE
|
||||||
|
Loading…
Reference in New Issue
Block a user