mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-07-10 05:17:24 +02:00
[ui] Paste a node on the mouse's position
When creating a node with a "paste" operation, place the node on the mouse's position in the graph instead of default position (0,0). If the mouse is placed on an existing node, the pasted node will be placed on the mouse's position plus an offset so that the pasted node does not directly overlap with the existing node.
This commit is contained in:
parent
ddda62a652
commit
5b65866e49
4 changed files with 14 additions and 8 deletions
|
@ -199,14 +199,15 @@ class PasteNodeCommand(GraphCommand):
|
|||
"""
|
||||
Handle node pasting in a Graph.
|
||||
"""
|
||||
def __init__(self, graph, nodeType, parent=None, **kwargs):
|
||||
def __init__(self, graph, nodeType, position=None, parent=None, **kwargs):
|
||||
super(PasteNodeCommand, self).__init__(graph, parent)
|
||||
self.nodeType = nodeType
|
||||
self.position = position
|
||||
self.nodeName = None
|
||||
self.kwargs = kwargs
|
||||
|
||||
def redoImpl(self):
|
||||
node = self.graph.pasteNode(self.nodeType, **self.kwargs)
|
||||
node = self.graph.pasteNode(self.nodeType, self.position, **self.kwargs)
|
||||
self.nodeName = node.name
|
||||
self.setText("Paste Node {}".format(self.nodeName))
|
||||
return node
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue