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
|
||||
.gitignore.meta
|
||||
.gitattributes.meta
|
||||
|
||||
# OS X only:
|
||||
.DS_Store
|
||||
@ -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:
|
||||
|
||||
@ -81,6 +81,8 @@ namespace XNodeEditor {
|
||||
graphEditor.OnWindowFocus();
|
||||
if (NodeEditorPreferences.GetSettings().autoSave) AssetDatabase.SaveAssets();
|
||||
}
|
||||
|
||||
dragThreshold = Math.Max(1f, Screen.width / 1000f);
|
||||
}
|
||||
|
||||
void OnLostFocus() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user