mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-08-03 16:58:24 +02:00
[ui] Ensure the edge connecting two nodes is following the mouse
Moving the mouse rapidly when starting to connect two nodes' attributes could lead to an unwanted offset between the tip of the edge and the mouse's position; it forced the user to move the mouse further than the attribute pin they wanted to connect to in order to actually be able to connect to it.
This commit is contained in:
parent
8eaef0b367
commit
47a99963fb
1 changed files with 7 additions and 2 deletions
|
@ -131,14 +131,16 @@ RowLayout {
|
|||
height: 4
|
||||
Drag.keys: [inputDragTarget.objectName]
|
||||
Drag.active: inputConnectMA.drag.active
|
||||
Drag.hotSpot.x: width*0.5
|
||||
Drag.hotSpot.y: height*0.5
|
||||
Drag.hotSpot.x: width * 0.5
|
||||
Drag.hotSpot.y: height * 0.5
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: inputConnectMA
|
||||
drag.target: attribute.isReadOnly ? undefined : inputDragTarget
|
||||
drag.threshold: 0
|
||||
// Move the edge's tip straight to the the current mouse position instead of waiting after the drag operation has started
|
||||
drag.smoothed: false
|
||||
enabled: !root.readOnly
|
||||
anchors.fill: parent
|
||||
// use the same negative margins as DropArea to ease pin selection
|
||||
|
@ -281,6 +283,8 @@ RowLayout {
|
|||
id: outputConnectMA
|
||||
drag.target: outputDragTarget
|
||||
drag.threshold: 0
|
||||
// Move the edge's tip straight to the the current mouse position instead of waiting after the drag operation has started
|
||||
drag.smoothed: false
|
||||
anchors.fill: parent
|
||||
// use the same negative margins as DropArea to ease pin selection
|
||||
anchors.margins: outputDropArea.anchors.margins
|
||||
|
@ -346,6 +350,7 @@ RowLayout {
|
|||
}
|
||||
StateChangeScript {
|
||||
script: {
|
||||
// Add the right offset if the initial click is not exactly at the center of the connection circle.
|
||||
var pos = inputDragTarget.mapFromItem(inputConnectMA, inputConnectMA.mouseX, inputConnectMA.mouseY);
|
||||
inputDragTarget.x = pos.x - inputDragTarget.width/2;
|
||||
inputDragTarget.y = pos.y - inputDragTarget.height/2;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue