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 Rect selectionBox;
|
||||||
private bool isDoubleClick = false;
|
private bool isDoubleClick = false;
|
||||||
private Vector2 lastMousePosition;
|
private Vector2 lastMousePosition;
|
||||||
|
private float dragThreshold = 1f;
|
||||||
|
|
||||||
public void Controls() {
|
public void Controls() {
|
||||||
wantsMouseMove = true;
|
wantsMouseMove = true;
|
||||||
@ -134,8 +135,11 @@ namespace XNodeEditor {
|
|||||||
Repaint();
|
Repaint();
|
||||||
}
|
}
|
||||||
} else if (e.button == 1 || e.button == 2) {
|
} else if (e.button == 1 || e.button == 2) {
|
||||||
panOffset += e.delta * zoom;
|
//check drag threshold for larger screens
|
||||||
isPanning = true;
|
if (e.delta.magnitude > dragThreshold) {
|
||||||
|
panOffset += e.delta * zoom;
|
||||||
|
isPanning = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EventType.MouseDown:
|
case EventType.MouseDown:
|
||||||
|
|||||||
@ -78,6 +78,8 @@ namespace XNodeEditor {
|
|||||||
current = this;
|
current = this;
|
||||||
ValidateGraphEditor();
|
ValidateGraphEditor();
|
||||||
if (graphEditor != null && NodeEditorPreferences.GetSettings().autoSave) AssetDatabase.SaveAssets();
|
if (graphEditor != null && NodeEditorPreferences.GetSettings().autoSave) AssetDatabase.SaveAssets();
|
||||||
|
|
||||||
|
dragThreshold = Screen.width / 1000f;
|
||||||
}
|
}
|
||||||
|
|
||||||
[InitializeOnLoadMethod]
|
[InitializeOnLoadMethod]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user