mirror of
https://github.com/Siccity/xNode.git
synced 2025-12-21 09:46:03 +08:00
Changed node selection to only react on header clicks
This commit is contained in:
parent
a09cda1827
commit
f87af8d62f
@ -71,10 +71,6 @@ namespace XNodeEditor {
|
|||||||
Repaint();
|
Repaint();
|
||||||
if (e.button == 0) {
|
if (e.button == 0) {
|
||||||
|
|
||||||
if (hoveredNode == null) Selection.activeObject = null;
|
|
||||||
else if (!Selection.Contains(hoveredNode)) SelectNode(hoveredNode, e.control || e.shift);
|
|
||||||
else if (e.control || e.shift) DeselectNode(hoveredNode);
|
|
||||||
|
|
||||||
if (IsHoveringPort) {
|
if (IsHoveringPort) {
|
||||||
if (hoveredPort.IsOutput) {
|
if (hoveredPort.IsOutput) {
|
||||||
draggedOutput = hoveredPort;
|
draggedOutput = hoveredPort;
|
||||||
@ -90,6 +86,9 @@ namespace XNodeEditor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (IsHoveringNode && IsHoveringTitle(hoveredNode)) {
|
} else if (IsHoveringNode && IsHoveringTitle(hoveredNode)) {
|
||||||
|
// If mousedown on node header, select or deselect
|
||||||
|
if (!Selection.Contains(hoveredNode)) SelectNode(hoveredNode, e.control || e.shift);
|
||||||
|
else if (e.control || e.shift) DeselectNode(hoveredNode);
|
||||||
e.Use();
|
e.Use();
|
||||||
DidDragNodeHeader = false;
|
DidDragNodeHeader = false;
|
||||||
CanDragNodeHeader = true;
|
CanDragNodeHeader = true;
|
||||||
@ -101,6 +100,10 @@ namespace XNodeEditor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// If mousedown on grid background, deselect all
|
||||||
|
else if (!IsHoveringNode) {
|
||||||
|
Selection.activeObject = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EventType.MouseUp:
|
case EventType.MouseUp:
|
||||||
@ -123,11 +126,18 @@ namespace XNodeEditor {
|
|||||||
} else if (CanDragNodeHeader) {
|
} else if (CanDragNodeHeader) {
|
||||||
CanDragNodeHeader = false;
|
CanDragNodeHeader = false;
|
||||||
AssetDatabase.SaveAssets();
|
AssetDatabase.SaveAssets();
|
||||||
} else if (GUIUtility.hotControl != 0) {
|
} else if (!IsHoveringNode) {
|
||||||
|
// If click outside node, release field focus
|
||||||
|
if (!isPanning) {
|
||||||
|
GUIUtility.hotControl = 0;
|
||||||
|
GUIUtility.keyboardControl = 0;
|
||||||
|
}
|
||||||
|
Repaint();
|
||||||
AssetDatabase.SaveAssets();
|
AssetDatabase.SaveAssets();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsHoveringNode && !DidDragNodeHeader && !(e.control || e.shift)) {
|
// If click node header, select single node.
|
||||||
|
if (IsHoveringNode && !DidDragNodeHeader && IsHoveringTitle(hoveredNode) && !(e.control || e.shift)) {
|
||||||
SelectNode(hoveredNode, false);
|
SelectNode(hoveredNode, false);
|
||||||
Repaint();
|
Repaint();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user