diff --git a/MiRCARTCanvas.py b/MiRCARTCanvas.py index 0503889..cb09834 100644 --- a/MiRCARTCanvas.py +++ b/MiRCARTCanvas.py @@ -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) diff --git a/MiRCARTCanvasJournal.py b/MiRCARTCanvasJournal.py index 3b70dbc..de9511d 100644 --- a/MiRCARTCanvasJournal.py +++ b/MiRCARTCanvasJournal.py @@ -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) diff --git a/MiRCARTFrame.py b/MiRCARTFrame.py index 233fb00..491be6a 100644 --- a/MiRCARTFrame.py +++ b/MiRCARTFrame.py @@ -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]: @@ -351,7 +356,7 @@ class MiRCARTFrame(MiRCARTGeneralFrame): pass elif cid == self.CID_LINE[0]: pass - elif cid >= self.CID_COLOUR00[0] \ + elif cid >= self.CID_COLOUR00[0] \ and cid <= self.CID_COLOUR15[0]: numColour = cid - self.CID_COLOUR00[0] if event.GetEventType() == wx.wxEVT_TOOL: diff --git a/MiRCARTToolRect.py b/MiRCARTToolRect.py index 71e226d..66a8864 100644 --- a/MiRCARTToolRect.py +++ b/MiRCARTToolRect.py @@ -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