1
0
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:
Chris Fairclough 2020-01-30 13:28:54 +00:00
parent 7e93ffe4b7
commit 68c6a609fe
2 changed files with 8 additions and 2 deletions

View File

@ -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:

View File

@ -78,6 +78,8 @@ namespace XNodeEditor {
current = this;
ValidateGraphEditor();
if (graphEditor != null && NodeEditorPreferences.GetSettings().autoSave) AssetDatabase.SaveAssets();
dragThreshold = Screen.width / 1000f;
}
[InitializeOnLoadMethod]