[ui] GraphEditor: allow replacing edges

This commit is contained in:
ChemicalXandco 2021-04-09 16:28:15 +01:00
parent 475fe6ca93
commit 3ea721a2ed
2 changed files with 9 additions and 5 deletions

View file

@ -87,7 +87,6 @@ RowLayout {
|| drag.source.objectName != inputDragTarget.objectName // not an edge connector
|| drag.source.baseType != inputDragTarget.baseType // not the same base type
|| drag.source.nodeItem == inputDragTarget.nodeItem // connection between attributes of the same node
|| inputDragTarget.attribute.isLink // already connected attribute
|| (drag.source.isList && !inputDragTarget.isList) // connection between a list and a simple attribute
|| (drag.source.isList && childrenRepeater.count) // source/target are lists but target already has children
|| drag.source.connectorType == "input" // refuse to connect an "input pin" on another one (input attr can be connected to input attr, but not the graphical pin)
@ -131,7 +130,7 @@ RowLayout {
MouseArea {
id: inputConnectMA
// If an input attribute is connected (isLink), we disable drag&drop
drag.target: (attribute.isLink || attribute.isReadOnly) ? undefined : inputDragTarget
drag.target: (attribute.isReadOnly) ? undefined : inputDragTarget
drag.threshold: 0
enabled: !root.readOnly
anchors.fill: parent
@ -227,7 +226,6 @@ RowLayout {
if( drag.source.objectName != outputDragTarget.objectName // not an edge connector
|| drag.source.baseType != outputDragTarget.baseType // not the same base type
|| drag.source.nodeItem == outputDragTarget.nodeItem // connection between attributes of the same node
|| drag.source.attribute.isLink // already connected attribute
|| (!drag.source.isList && outputDragTarget.isList) // connection between a list and a simple attribute
|| (drag.source.isList && childrenRepeater.count) // source/target are lists but target already has children
|| drag.source.connectorType == "output" // refuse to connect an output pin on another one
@ -295,7 +293,7 @@ RowLayout {
}
}
state: (inputConnectMA.pressed && !attribute.isLink) ? "DraggingInput" : outputConnectMA.pressed ? "DraggingOutput" : ""
state: (inputConnectMA.pressed) ? "DraggingInput" : outputConnectMA.pressed ? "DraggingOutput" : ""
states: [
State {