mirror of
https://github.com/lalbornoz/roar.git
synced 2024-11-26 16:56:37 +00:00
MiRCARTCanvasInterface.py:_updateCanvasSize(): reimplement (fixes <Alt> [WASD] bugs.)
This commit is contained in:
parent
77eb660f35
commit
1a9c08a3fd
@ -48,17 +48,39 @@ class MiRCARTCanvasInterface():
|
|||||||
# {{{ _updateCanvasSize(self, newCanvasSize): XXX
|
# {{{ _updateCanvasSize(self, newCanvasSize): XXX
|
||||||
def _updateCanvasSize(self, newCanvasSize):
|
def _updateCanvasSize(self, newCanvasSize):
|
||||||
eventDc = self.parentCanvas.canvasBackend.getDeviceContext(self.parentCanvas)
|
eventDc = self.parentCanvas.canvasBackend.getDeviceContext(self.parentCanvas)
|
||||||
|
oldCanvasSize = self.parentCanvas.canvasSize
|
||||||
self.parentCanvas.resize(newCanvasSize)
|
self.parentCanvas.resize(newCanvasSize)
|
||||||
self.parentCanvas.canvasBackend.resize( \
|
self.parentCanvas.canvasBackend.resize( \
|
||||||
newCanvasSize, \
|
newCanvasSize, \
|
||||||
self.parentCanvas.canvasBackend.cellSize)
|
self.parentCanvas.canvasBackend.cellSize)
|
||||||
for numRow in range(self.parentCanvas.canvasSize[1] - 1):
|
if (newCanvasSize[1] - oldCanvasSize[1]) < 0:
|
||||||
self.parentCanvas.canvasMap.append([[1, 1], 0, " "])
|
for numRowOff in range(1, (oldCanvasSize[1] - newCanvasSize[1]) + 1):
|
||||||
self.parentCanvas.canvasMap.append([])
|
numRow = oldCanvasSize[1] - numRowOff
|
||||||
for numCol in range(self.parentCanvas.canvasSize[0]):
|
del self.parentCanvas.canvasMap[numRow]
|
||||||
self.parentCanvas.canvasMap[-1].append([[1, 1], 0, " "])
|
else:
|
||||||
self.parentCanvas.canvasBackend.drawPatch(eventDc, \
|
for numRowOff in range(oldCanvasSize[1] - newCanvasSize[1]):
|
||||||
([numCol, self.parentCanvas.canvasSize[1] - 1], *[[1, 1], 0, " "]))
|
numRow = oldCanvasSize[1] + numRowOff
|
||||||
|
self.parentCanvas.canvasMap.append(None)
|
||||||
|
self.parentCanvas.canvasMap[numRow] = \
|
||||||
|
[[[1, 1], 0, " "]] * oldCanvasSize[0]
|
||||||
|
self.parentCanvas.canvasBackend.drawPatch( \
|
||||||
|
eventDc, \
|
||||||
|
[[numCol, numRow], *[[1, 1], 0, " "]])
|
||||||
|
if (newCanvasSize[0] - oldCanvasSize[0]) < 0:
|
||||||
|
for numRow in range(newCanvasSize[1]):
|
||||||
|
for numColOff in range(1, (oldCanvasSize[0] - newCanvasSize[0]) + 1):
|
||||||
|
numCol = oldCanvasSize[0] - numColOff
|
||||||
|
del self.parentCanvas.canvasMap[numRow][numCol]
|
||||||
|
else:
|
||||||
|
for numRow in range(newCanvasSize[1]):
|
||||||
|
for numColOff in range(newCanvasSize[0] - oldCanvasSize[0]):
|
||||||
|
numCol = oldCanvasSize[0] + numColOff
|
||||||
|
self.parentCanvas.canvasMap[numRow].append(None)
|
||||||
|
self.parentCanvas.canvasMap[numRow][numCol] = \
|
||||||
|
[[1, 1], 0, " "]
|
||||||
|
self.parentCanvas.canvasBackend.drawPatch( \
|
||||||
|
eventDc, \
|
||||||
|
[[numCol, numRow], *[[1, 1], 0, " "]])
|
||||||
wx.SafeYield()
|
wx.SafeYield()
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user