Skip to content

Commit 5a00360

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

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
@@ -992,8 +992,6 @@ Item {
992992
// The Item instantiating the delegates.
993993
modelInstantiator: nodeRepeater
994994

995-
property var nodes: []
996-
997995
mainSelected: uigraph.selectedNode === node
998996
hovered: uigraph.hoveredNode === node
999997

@@ -1044,6 +1042,10 @@ Item {
10441042
uigraph.selectedNode = node;
10451043
}
10461044

1045+
if (!(mouse.modifiers & Qt.AltModifier)) {
1046+
uigraph.selectNodesByIndices(childrenIndices, ItemSelectionModel.Select);
1047+
}
1048+
10471049
// Open the node context menu once selection has been updated.
10481050
if(mouse.button == Qt.RightButton) {
10491051
nodeMenuLoader.load(node)
@@ -1060,6 +1062,10 @@ Item {
10601062
return;
10611063
}
10621064
uigraph.selectNodeByIndex(index);
1065+
1066+
if (!(mouse.modifiers & Qt.AltModifier)) {
1067+
uigraph.selectNodesByIndices(childrenIndices, ItemSelectionModel.Select);
1068+
}
10631069
}
10641070

10651071
onDoubleClicked: function(mouse) { root.nodeDoubleClicked(mouse, node) }
@@ -1084,42 +1090,19 @@ Item {
10841090
// Compute offset between the delegate and the stored node position.
10851091
const offset = Qt.point(x - node.x, y - node.y);
10861092

1087-
nodes = []
1088-
// Get all of the current children for the backdrop
1089-
let children = getChildrenNodes();
1090-
1091-
for (var i = 0; i < children.length; i++) {
1092-
const delegate = children[i];
1093-
1094-
// Ignore the selected delegates as they will be iterated upon separately
1095-
if (delegate.selected)
1096-
continue;
1097-
1098-
delegate.x = delegate.node.x + offset.x;
1099-
delegate.y = delegate.node.y + offset.y;
1100-
1101-
// If the delegate is not the current Node
1102-
if (delegate !== node)
1103-
nodes.push(delegate.node);
1104-
}
1105-
11061093
uigraph.nodeSelection.selectedIndexes.forEach(function(idx) {
11071094
if(idx != index) {
11081095
const delegate = nodeRepeater.itemAt(idx.row).item;
11091096
delegate.x = delegate.node.x + offset.x;
11101097
delegate.y = delegate.node.y + offset.y;
1111-
1112-
// If the delegate is not the current Node
1113-
if (delegate !== node)
1114-
nodes.push(delegate.node);
11151098
}
11161099
});
11171100
}
11181101

11191102
// After drag: apply the final offset to all selected nodes
11201103
onMoved: function(position) {
11211104
const offset = Qt.point(position.x - node.x, position.y - node.y);
1122-
uigraph.moveNodesBy(nodes, offset);
1105+
uigraph.moveSelectedNodesBy(offset);
11231106
}
11241107

11251108
Behavior on x {

0 commit comments

Comments
 (0)