mirror of
https://github.com/lalbornoz/roar.git
synced 2024-11-22 15:26:37 +00:00
MiRCART{CanvasJournal,Frame,ToolRect}.py: implements variable brush size.
This commit is contained in:
parent
6a4356568b
commit
54adf3a95c
@ -221,6 +221,7 @@ class MiRCARTCanvas(wx.Panel):
|
||||
|
||||
super().__init__(parent, pos=canvasPos, \
|
||||
size=[w*h for w,h in zip(canvasSize, cellSize)])
|
||||
self.SetDoubleBuffered(True)
|
||||
self.Bind(wx.EVT_CLOSE, self.onClose)
|
||||
self.Bind(wx.EVT_ENTER_WINDOW, self.onMouseWindowEvent)
|
||||
self.Bind(wx.EVT_LEAVE_WINDOW, self.onMouseWindowEvent)
|
||||
|
@ -60,7 +60,10 @@ class MiRCARTCanvasJournal():
|
||||
self._popTmp(eventDc, tmpDc)
|
||||
for patch in mapPatch[1]:
|
||||
absMapPoint = self._relMapPointToAbsMapPoint(patch[0], atPoint)
|
||||
if mapPatchTmp:
|
||||
if absMapPoint[0] >= self.parentCanvas.canvasSize[0] \
|
||||
or absMapPoint[1] >= self.parentCanvas.canvasSize[1]:
|
||||
continue
|
||||
elif mapPatchTmp:
|
||||
self._pushTmp(absMapPoint)
|
||||
self.parentCanvas.onJournalUpdate(mapPatchTmp, \
|
||||
absMapPoint, patch, eventDc, tmpDc, atPoint)
|
||||
|
@ -340,9 +340,14 @@ class MiRCARTFrame(MiRCARTGeneralFrame):
|
||||
elif cid == self.CID_DELETE[0]:
|
||||
pass
|
||||
elif cid == self.CID_INCRBRUSH[0]:
|
||||
pass
|
||||
elif cid == self.CID_DECRBRUSH[0]:
|
||||
pass
|
||||
self.panelCanvas.brushSize = \
|
||||
[a+1 for a in self.panelCanvas.brushSize]
|
||||
print(self.panelCanvas.brushSize)
|
||||
elif cid == self.CID_DECRBRUSH[0] \
|
||||
and self.panelCanvas.brushSize != [0,0]:
|
||||
self.panelCanvas.brushSize = \
|
||||
[a-1 for a in self.panelCanvas.brushSize]
|
||||
print(self.panelCanvas.brushSize)
|
||||
elif cid == self.CID_SOLID_BRUSH[0]:
|
||||
pass
|
||||
elif cid == self.CID_RECT[0]:
|
||||
|
@ -33,14 +33,18 @@ class MiRCARTToolRect(MiRCARTTool):
|
||||
brushColours = brushColours.copy()
|
||||
if isLeftDown:
|
||||
brushColours[1] = brushColours[0]
|
||||
return [[False, [[[0, 0], brushColours, 0, " "]]], \
|
||||
[True, [[[0, 0], brushColours, 0, " "]]]]
|
||||
elif isRightDown:
|
||||
brushColours[0] = brushColours[1]
|
||||
return [[False, [[[0, 0], brushColours, 0, " "]]], \
|
||||
[True, [[[0, 0], brushColours, 0, " "]]]]
|
||||
else:
|
||||
brushColours[1] = brushColours[0]
|
||||
return [[True, [[[0, 0], brushColours, 0, " "]]]]
|
||||
brushPatches = []
|
||||
for brushRow in range(brushSize[1]):
|
||||
for brushCol in range(brushSize[0] * 2):
|
||||
brushPatches.append([[brushCol, brushRow], \
|
||||
brushColours, 0, " "])
|
||||
if isLeftDown or isRightDown:
|
||||
return [[False, brushPatches], [True, brushPatches]]
|
||||
else:
|
||||
return [[True, brushPatches]]
|
||||
|
||||
# vim:expandtab foldmethod=marker sw=4 ts=4 tw=120
|
||||
|
Loading…
Reference in New Issue
Block a user