mirror of
https://github.com/Siccity/xNode.git
synced 2025-12-20 01:06:01 +08:00
Add a dragthreshold to better distunguish right clicks and right drags (#230)
* add a drag threshold so right clicks are better distinguished from right drags especially on large screens * ignore mac files too * dont use less than 1 as a drag threshold Co-authored-by: Chris Fairclough <chris@zulleon.com>
This commit is contained in:
parent
8046e6e0bf
commit
a8daac60b0
3
.gitignore
vendored
3
.gitignore
vendored
@ -25,3 +25,6 @@ sysinfo.txt
|
|||||||
.git.meta
|
.git.meta
|
||||||
.gitignore.meta
|
.gitignore.meta
|
||||||
.gitattributes.meta
|
.gitattributes.meta
|
||||||
|
|
||||||
|
# OS X only:
|
||||||
|
.DS_Store
|
||||||
@ -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:
|
||||||
|
|||||||
@ -81,6 +81,8 @@ namespace XNodeEditor {
|
|||||||
graphEditor.OnWindowFocus();
|
graphEditor.OnWindowFocus();
|
||||||
if (NodeEditorPreferences.GetSettings().autoSave) AssetDatabase.SaveAssets();
|
if (NodeEditorPreferences.GetSettings().autoSave) AssetDatabase.SaveAssets();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dragThreshold = Math.Max(1f, Screen.width / 1000f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnLostFocus() {
|
void OnLostFocus() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user