Skip to content

Commit f3b5d7d

Browse files
committed
[ui] GraphEditor: Selection of children when a backdrop is selected
Moving backdrop now directly moves the selected children explicitly
1 parent fa11dd6 commit f3b5d7d

File tree

1 file changed

+9
-26
lines changed

1 file changed

+9
-26
lines changed

meshroom/ui/qml/GraphEditor/GraphEditor.qml

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -999,8 +999,6 @@ Item {
999999
// The Item instantiating the delegates.
10001000
modelInstantiator: nodeRepeater
10011001

1002-
property var nodes: []
1003-
10041002
mainSelected: uigraph.selectedNode === node
10051003
hovered: uigraph.hoveredNode === node
10061004

@@ -1051,6 +1049,10 @@ Item {
10511049
uigraph.selectedNode = node;
10521050
}
10531051

1052+
if (!(mouse.modifiers & Qt.AltModifier)) {
1053+
uigraph.selectNodesByIndices(childrenIndices, ItemSelectionModel.Select);
1054+
}
1055+
10541056
// Open the node context menu once selection has been updated.
10551057
if(mouse.button == Qt.RightButton) {
10561058
nodeMenuLoader.load(node)
@@ -1067,6 +1069,10 @@ Item {
10671069
return;
10681070
}
10691071
uigraph.selectNodeByIndex(index);
1072+
1073+
if (!(mouse.modifiers & Qt.AltModifier)) {
1074+
uigraph.selectNodesByIndices(childrenIndices, ItemSelectionModel.Select);
1075+
}
10701076
}
10711077

10721078
onDoubleClicked: function(mouse) { root.nodeDoubleClicked(mouse, node) }
@@ -1091,42 +1097,19 @@ Item {
10911097
// Compute offset between the delegate and the stored node position.
10921098
const offset = Qt.point(x - node.x, y - node.y);
10931099

1094-
nodes = []
1095-
// Get all of the current children for the backdrop
1096-
let children = getChildrenNodes();
1097-
1098-
for (var i = 0; i < children.length; i++) {
1099-
const delegate = children[i];
1100-
1101-
// Ignore the selected delegates as they will be iterated upon separately
1102-
if (delegate.selected)
1103-
continue;
1104-
1105-
delegate.x = delegate.node.x + offset.x;
1106-
delegate.y = delegate.node.y + offset.y;
1107-
1108-
// If the delegate is not the current Node
1109-
if (delegate !== node)
1110-
nodes.push(delegate.node);
1111-
}
1112-
11131100
uigraph.nodeSelection.selectedIndexes.forEach(function(idx) {
11141101
if(idx != index) {
11151102
const delegate = nodeRepeater.itemAt(idx.row).item;
11161103
delegate.x = delegate.node.x + offset.x;
11171104
delegate.y = delegate.node.y + offset.y;
1118-
1119-
// If the delegate is not the current Node
1120-
if (delegate !== node)
1121-
nodes.push(delegate.node);
11221105
}
11231106
});
11241107
}
11251108

11261109
// After drag: apply the final offset to all selected nodes
11271110
onMoved: function(position) {
11281111
const offset = Qt.point(position.x - node.x, position.y - node.y);
1129-
uigraph.moveNodesBy(nodes, offset);
1112+
uigraph.moveSelectedNodesBy(offset);
11301113
}
11311114

11321115
Behavior on x {

0 commit comments

Comments
 (0)