mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-06-06 04:41:58 +02:00
[ui] Graph: Added Functionality to modify node position and dimensions
This commit is contained in:
parent
dc5d7dd78c
commit
fce662b7f0
1 changed files with 25 additions and 0 deletions
|
@ -666,6 +666,22 @@ class UIGraph(QObject):
|
|||
"""
|
||||
self.push(commands.MoveNodeCommand(self._graph, node, position))
|
||||
|
||||
@Slot(Node, float, float)
|
||||
def resizeNode(self, node, width, height):
|
||||
""" Resizes the Node.
|
||||
|
||||
Args:
|
||||
node (Node): the node to move
|
||||
width (float): Node width.
|
||||
height (float): Node height.
|
||||
"""
|
||||
# Update the node size
|
||||
with self.groupedGraphModification("Resize Node"):
|
||||
if node.hasInternalAttribute("nodeWidth"):
|
||||
self.setAttribute(node.internalAttribute("nodeWidth"), width)
|
||||
if node.hasInternalAttribute("nodeHeight"):
|
||||
self.setAttribute(node.internalAttribute("nodeHeight"), height)
|
||||
|
||||
@Slot(QPoint)
|
||||
def moveSelectedNodesBy(self, offset: QPoint):
|
||||
"""Move all the selected nodes by the given `offset`."""
|
||||
|
@ -675,6 +691,15 @@ class UIGraph(QObject):
|
|||
position = Position(node.x + offset.x(), node.y + offset.y())
|
||||
self.moveNode(node, position)
|
||||
|
||||
@Slot(list, QPoint)
|
||||
def moveNodesBy(self, nodes, offset: QPoint):
|
||||
"""Move all the selected nodes by the given `offset`."""
|
||||
|
||||
with self.groupedGraphModification("Move Nodes"):
|
||||
for node in nodes:
|
||||
position = Position(node.x + offset.x(), node.y + offset.y())
|
||||
self.moveNode(node, position)
|
||||
|
||||
@Slot()
|
||||
def removeSelectedNodes(self):
|
||||
"""Remove selected nodes from the graph."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue