1
0
mirror of https://github.com/Siccity/xNode.git synced 2026-03-26 22:49:02 +08:00
This commit is contained in:
Icarus 2019-12-09 11:11:47 +08:00
parent cf6cddeae5
commit cf59838dd0
2 changed files with 10 additions and 10 deletions

View File

@ -32,8 +32,14 @@ namespace XNodeEditor {
private Rect selectionBox;
private bool isDoubleClick = false;
private Vector2 lastMousePosition;
private MenuPopupWindow _menuPopupWindow;
public void Controls() {
if (_menuPopupWindow == null)
{
_menuPopupWindow = new MenuPopupWindow();
graphEditor.AddContextMenuItems(_menuPopupWindow);
}
wantsMouseMove = true;
Event e = Event.current;
switch (e.type) {
@ -219,12 +225,9 @@ namespace XNodeEditor {
}
// Open context menu for auto-connection
else if (NodeEditorPreferences.GetSettings().dragToCreate && autoConnectOutput != null) {
MenuPopupWindow menu = new MenuPopupWindow();
graphEditor.AddContextMenuItems(menu);
_menuPopupWindow.OnCloseA = _releaseDraggedConnection;
menu.OnCloseA += _releaseDraggedConnection;
PopupWindow.Show(new Rect(Event.current.mousePosition, Vector2.zero),menu);
PopupWindow.Show(new Rect(Event.current.mousePosition, Vector2.zero),_menuPopupWindow);
}
_releaseDraggedConnection();
@ -281,10 +284,8 @@ namespace XNodeEditor {
menu.DropDown(new Rect(Event.current.mousePosition, Vector2.zero));
e.Use(); // Fixes copy/paste context menu appearing in Unity 5.6.6f2 - doesn't occur in 2018.3.2f1 Probably needs to be used in other places.
} else if (!IsHoveringNode) {
autoConnectOutput = null;
MenuPopupWindow menu = new MenuPopupWindow();
graphEditor.AddContextMenuItems(menu);
PopupWindow.Show(new Rect(Event.current.mousePosition, Vector2.zero),menu);
autoConnectOutput = null;
PopupWindow.Show(new Rect(Event.current.mousePosition, Vector2.zero),_menuPopupWindow);
}
}
isPanning = false;

View File

@ -106,7 +106,6 @@ namespace XNodeEditor {
void OnFocus() {
current = this;
ValidateGraphEditor();
graphEditor?.OnFocus();
if (graphEditor != null && NodeEditorPreferences.GetSettings().autoSave) AssetDatabase.SaveAssets();
}