mirror of
https://github.com/Siccity/xNode.git
synced 2026-03-26 22:49:02 +08:00
add a drag threshold so right clicks are better distinguished from right drags especially on large screens
This commit is contained in:
parent
7e93ffe4b7
commit
68c6a609fe
@ -32,6 +32,7 @@ namespace XNodeEditor {
|
||||
private Rect selectionBox;
|
||||
private bool isDoubleClick = false;
|
||||
private Vector2 lastMousePosition;
|
||||
private float dragThreshold = 1f;
|
||||
|
||||
public void Controls() {
|
||||
wantsMouseMove = true;
|
||||
@ -134,8 +135,11 @@ namespace XNodeEditor {
|
||||
Repaint();
|
||||
}
|
||||
} else if (e.button == 1 || e.button == 2) {
|
||||
panOffset += e.delta * zoom;
|
||||
isPanning = true;
|
||||
//check drag threshold for larger screens
|
||||
if (e.delta.magnitude > dragThreshold) {
|
||||
panOffset += e.delta * zoom;
|
||||
isPanning = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EventType.MouseDown:
|
||||
|
||||
@ -78,6 +78,8 @@ namespace XNodeEditor {
|
||||
current = this;
|
||||
ValidateGraphEditor();
|
||||
if (graphEditor != null && NodeEditorPreferences.GetSettings().autoSave) AssetDatabase.SaveAssets();
|
||||
|
||||
dragThreshold = Screen.width / 1000f;
|
||||
}
|
||||
|
||||
[InitializeOnLoadMethod]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user