mirror of
https://github.com/lalbornoz/roar.git
synced 2024-11-22 23:36:36 +00:00
Apply tool w/ mouse state on brush/colour update.
This commit is contained in:
parent
c4e78cb241
commit
0064ea7a3b
@ -55,7 +55,7 @@ class RoarCanvasCommandsEdit():
|
|||||||
[self.canvasBrushSize(f, dimension_, incrFlag)(None) for dimension_ in [0, 1]]
|
[self.canvasBrushSize(f, dimension_, incrFlag)(None) for dimension_ in [0, 1]]
|
||||||
viewRect = self.parentCanvas.GetViewStart()
|
viewRect = self.parentCanvas.GetViewStart()
|
||||||
eventDc = self.parentCanvas.backend.getDeviceContext(self.parentCanvas.GetClientSize(), self.parentCanvas, viewRect)
|
eventDc = self.parentCanvas.backend.getDeviceContext(self.parentCanvas.GetClientSize(), self.parentCanvas, viewRect)
|
||||||
self.parentCanvas.applyTool(eventDc, True, None, None, None, self.parentCanvas.brushPos, False, False, False, self.currentTool, viewRect, force=True)
|
self.parentCanvas.applyTool(eventDc, True, None, None, None, self.parentCanvas.brushPos, *self.parentCanvas.lastMouseState, self.currentTool, viewRect, force=True)
|
||||||
setattr(canvasBrushSize_, "attrDict", f.attrList[dimension + (0 if not incrFlag else 3)])
|
setattr(canvasBrushSize_, "attrDict", f.attrList[dimension + (0 if not incrFlag else 3)])
|
||||||
return canvasBrushSize_
|
return canvasBrushSize_
|
||||||
|
|
||||||
@ -109,7 +109,7 @@ class RoarCanvasCommandsEdit():
|
|||||||
self.update(colours=self.parentCanvas.brushColours)
|
self.update(colours=self.parentCanvas.brushColours)
|
||||||
viewRect = self.parentCanvas.GetViewStart()
|
viewRect = self.parentCanvas.GetViewStart()
|
||||||
eventDc = self.parentCanvas.backend.getDeviceContext(self.parentCanvas.GetClientSize(), self.parentCanvas, viewRect)
|
eventDc = self.parentCanvas.backend.getDeviceContext(self.parentCanvas.GetClientSize(), self.parentCanvas, viewRect)
|
||||||
self.parentCanvas.applyTool(eventDc, True, None, None, None, self.parentCanvas.brushPos, False, False, False, self.currentTool, viewRect, force=True)
|
self.parentCanvas.applyTool(eventDc, True, None, None, None, self.parentCanvas.brushPos, *self.parentCanvas.lastMouseState, self.currentTool, viewRect, force=True)
|
||||||
setattr(canvasColour_, "attrDict", f.attrList[idx])
|
setattr(canvasColour_, "attrDict", f.attrList[idx])
|
||||||
setattr(canvasColour_, "isSelect", True)
|
setattr(canvasColour_, "isSelect", True)
|
||||||
return canvasColour_
|
return canvasColour_
|
||||||
@ -124,7 +124,7 @@ class RoarCanvasCommandsEdit():
|
|||||||
self.update(colours=self.parentCanvas.brushColours)
|
self.update(colours=self.parentCanvas.brushColours)
|
||||||
viewRect = self.parentCanvas.GetViewStart()
|
viewRect = self.parentCanvas.GetViewStart()
|
||||||
eventDc = self.parentCanvas.backend.getDeviceContext(self.parentCanvas.GetClientSize(), self.parentCanvas, viewRect)
|
eventDc = self.parentCanvas.backend.getDeviceContext(self.parentCanvas.GetClientSize(), self.parentCanvas, viewRect)
|
||||||
self.parentCanvas.applyTool(eventDc, True, None, None, None, self.parentCanvas.brushPos, False, False, False, self.currentTool, viewRect, force=True)
|
self.parentCanvas.applyTool(eventDc, True, None, None, None, self.parentCanvas.brushPos, *self.parentCanvas.lastMouseState, self.currentTool, viewRect, force=True)
|
||||||
setattr(canvasColourAlpha_, "attrDict", f.attrList[idx])
|
setattr(canvasColourAlpha_, "attrDict", f.attrList[idx])
|
||||||
setattr(canvasColourAlpha_, "isSelect", True)
|
setattr(canvasColourAlpha_, "isSelect", True)
|
||||||
return canvasColourAlpha_
|
return canvasColourAlpha_
|
||||||
@ -136,7 +136,7 @@ class RoarCanvasCommandsEdit():
|
|||||||
self.update(colours=self.parentCanvas.brushColours)
|
self.update(colours=self.parentCanvas.brushColours)
|
||||||
viewRect = self.parentCanvas.GetViewStart()
|
viewRect = self.parentCanvas.GetViewStart()
|
||||||
eventDc = self.parentCanvas.backend.getDeviceContext(self.parentCanvas.GetClientSize(), self.parentCanvas, viewRect)
|
eventDc = self.parentCanvas.backend.getDeviceContext(self.parentCanvas.GetClientSize(), self.parentCanvas, viewRect)
|
||||||
self.parentCanvas.applyTool(eventDc, True, None, None, None, self.parentCanvas.brushPos, False, False, False, self.currentTool, viewRect, force=True)
|
self.parentCanvas.applyTool(eventDc, True, None, None, None, self.parentCanvas.brushPos, *self.parentCanvas.lastMouseState, self.currentTool, viewRect, force=True)
|
||||||
setattr(canvasColourAlphaBackground_, "attrDict", f.attrList[idx])
|
setattr(canvasColourAlphaBackground_, "attrDict", f.attrList[idx])
|
||||||
setattr(canvasColourAlphaBackground_, "isSelect", True)
|
setattr(canvasColourAlphaBackground_, "isSelect", True)
|
||||||
return canvasColourAlphaBackground_
|
return canvasColourAlphaBackground_
|
||||||
@ -163,7 +163,7 @@ class RoarCanvasCommandsEdit():
|
|||||||
self.update(colours=self.parentCanvas.brushColours)
|
self.update(colours=self.parentCanvas.brushColours)
|
||||||
viewRect = self.parentCanvas.GetViewStart()
|
viewRect = self.parentCanvas.GetViewStart()
|
||||||
eventDc = self.parentCanvas.backend.getDeviceContext(self.parentCanvas.GetClientSize(), self.parentCanvas, viewRect)
|
eventDc = self.parentCanvas.backend.getDeviceContext(self.parentCanvas.GetClientSize(), self.parentCanvas, viewRect)
|
||||||
self.parentCanvas.applyTool(eventDc, True, None, None, None, self.parentCanvas.brushPos, False, False, False, self.currentTool, viewRect, force=True)
|
self.parentCanvas.applyTool(eventDc, True, None, None, None, self.parentCanvas.brushPos, *self.parentCanvas.lastMouseState, self.currentTool, viewRect, force=True)
|
||||||
setattr(canvasColourBackground_, "attrDict", f.attrList[idx])
|
setattr(canvasColourBackground_, "attrDict", f.attrList[idx])
|
||||||
setattr(canvasColourBackground_, "isSelect", True)
|
setattr(canvasColourBackground_, "isSelect", True)
|
||||||
return canvasColourBackground_
|
return canvasColourBackground_
|
||||||
@ -174,7 +174,7 @@ class RoarCanvasCommandsEdit():
|
|||||||
self.update(colours=self.parentCanvas.brushColours)
|
self.update(colours=self.parentCanvas.brushColours)
|
||||||
viewRect = self.parentCanvas.GetViewStart()
|
viewRect = self.parentCanvas.GetViewStart()
|
||||||
eventDc = self.parentCanvas.backend.getDeviceContext(self.parentCanvas.GetClientSize(), self.parentCanvas, viewRect)
|
eventDc = self.parentCanvas.backend.getDeviceContext(self.parentCanvas.GetClientSize(), self.parentCanvas, viewRect)
|
||||||
self.parentCanvas.applyTool(eventDc, True, None, None, None, self.parentCanvas.brushPos, False, False, False, self.currentTool, viewRect, force=True)
|
self.parentCanvas.applyTool(eventDc, True, None, None, None, self.parentCanvas.brushPos, *self.parentCanvas.lastMouseState, self.currentTool, viewRect, force=True)
|
||||||
|
|
||||||
@GuiCommandDecorator("Copy", "&Copy", ["", wx.ART_COPY], None, False)
|
@GuiCommandDecorator("Copy", "&Copy", ["", wx.ART_COPY], None, False)
|
||||||
def canvasCopy(self, event):
|
def canvasCopy(self, event):
|
||||||
|
@ -227,6 +227,7 @@ class RoarCanvasWindow(GuiWindow):
|
|||||||
def onMouseInput(self, event):
|
def onMouseInput(self, event):
|
||||||
viewRect = self.GetViewStart(); eventDc = self.backend.getDeviceContext(self.GetClientSize(), self, viewRect);
|
viewRect = self.GetViewStart(); eventDc = self.backend.getDeviceContext(self.GetClientSize(), self, viewRect);
|
||||||
mouseDragging, mouseLeftDown, mouseRightDown = event.Dragging(), event.LeftIsDown(), event.RightIsDown()
|
mouseDragging, mouseLeftDown, mouseRightDown = event.Dragging(), event.LeftIsDown(), event.RightIsDown()
|
||||||
|
self.lastMouseState = [mouseDragging, mouseLeftDown, mouseRightDown]
|
||||||
mapPoint = self.backend.xlateEventPoint(event, eventDc, viewRect)
|
mapPoint = self.backend.xlateEventPoint(event, eventDc, viewRect)
|
||||||
if viewRect != (0, 0):
|
if viewRect != (0, 0):
|
||||||
mapPoint = [a + b for a, b in zip(mapPoint, viewRect)]
|
mapPoint = [a + b for a, b in zip(mapPoint, viewRect)]
|
||||||
@ -322,7 +323,7 @@ class RoarCanvasWindow(GuiWindow):
|
|||||||
|
|
||||||
def __init__(self, backend, canvas, commands, parent, pos, size):
|
def __init__(self, backend, canvas, commands, parent, pos, size):
|
||||||
super().__init__(parent, pos)
|
super().__init__(parent, pos)
|
||||||
self.size = size
|
self.lastMouseState, self.size = [False, False, False], size
|
||||||
self.backend, self.canvas, self.commands, self.parentFrame = backend(self.size), canvas, commands(self, parent), parent
|
self.backend, self.canvas, self.commands, self.parentFrame = backend(self.size), canvas, commands(self, parent), parent
|
||||||
self.brushColours, self.brushPos, self.brushSize, self.dirty, self.lastCellState = [4, 1], [0, 0], [1, 1], False, None
|
self.brushColours, self.brushPos, self.brushSize, self.dirty, self.lastCellState = [4, 1], [0, 0], [1, 1], False, None
|
||||||
self.popupEventDc = None
|
self.popupEventDc = None
|
||||||
|
Loading…
Reference in New Issue
Block a user