mirror of
https://github.com/Siccity/xNode.git
synced 2026-03-26 22:49:02 +08:00
!B(Create Node) pos error
This commit is contained in:
parent
7e4e4b6f8e
commit
c0b80b59da
@ -227,7 +227,7 @@ namespace XNodeEditor {
|
|||||||
// Open context menu for auto-connection
|
// Open context menu for auto-connection
|
||||||
else if (NodeEditorPreferences.GetSettings().dragToCreate && autoConnectOutput != null) {
|
else if (NodeEditorPreferences.GetSettings().dragToCreate && autoConnectOutput != null) {
|
||||||
_menuPopupWindow.OnCloseA = _releaseDraggedConnection;
|
_menuPopupWindow.OnCloseA = _releaseDraggedConnection;
|
||||||
|
_menuPopupWindow.OpenBeforeMousePos = e.mousePosition;
|
||||||
PopupWindow.Show(new Rect(Event.current.mousePosition, Vector2.zero),_menuPopupWindow);
|
PopupWindow.Show(new Rect(Event.current.mousePosition, Vector2.zero),_menuPopupWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,6 +286,7 @@ namespace XNodeEditor {
|
|||||||
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.
|
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) {
|
} else if (!IsHoveringNode) {
|
||||||
autoConnectOutput = null;
|
autoConnectOutput = null;
|
||||||
|
_menuPopupWindow.OpenBeforeMousePos = e.mousePosition;
|
||||||
PopupWindow.Show(new Rect(Event.current.mousePosition, Vector2.zero),_menuPopupWindow);
|
PopupWindow.Show(new Rect(Event.current.mousePosition, Vector2.zero),_menuPopupWindow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@ using UnityEngine;
|
|||||||
namespace XNodeEditor {
|
namespace XNodeEditor {
|
||||||
public class MenuPopupWindow : PopupWindowContent
|
public class MenuPopupWindow : PopupWindowContent
|
||||||
{
|
{
|
||||||
|
public Vector2 OpenBeforeMousePos;
|
||||||
private SearchField _search;
|
private SearchField _search;
|
||||||
private MenuTreeView _menuTree;
|
private MenuTreeView _menuTree;
|
||||||
public Action OnCloseA;
|
public Action OnCloseA;
|
||||||
@ -293,13 +294,18 @@ namespace XNodeEditor {
|
|||||||
if (string.IsNullOrEmpty(path)) continue;
|
if (string.IsNullOrEmpty(path)) continue;
|
||||||
|
|
||||||
menu.AddItem(path, () => {
|
menu.AddItem(path, () => {
|
||||||
|
pos = NodeEditorWindow.current.WindowToGridPosition(menu.OpenBeforeMousePos);
|
||||||
XNode.Node node = CreateNode(type, pos);
|
XNode.Node node = CreateNode(type, pos);
|
||||||
NodeEditorWindow.current.AutoConnect(node);
|
NodeEditorWindow.current.AutoConnect(node);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// menu.AddSeparator("");
|
// menu.AddSeparator("");
|
||||||
if (NodeEditorWindow.copyBuffer != null && NodeEditorWindow.copyBuffer.Length > 0)
|
if (NodeEditorWindow.copyBuffer != null && NodeEditorWindow.copyBuffer.Length > 0)
|
||||||
menu.AddItem("Paste", () => NodeEditorWindow.current.PasteNodes(pos));
|
menu.AddItem("Paste", () =>
|
||||||
|
{
|
||||||
|
pos = NodeEditorWindow.current.WindowToGridPosition(menu.OpenBeforeMousePos);
|
||||||
|
NodeEditorWindow.current.PasteNodes(pos);
|
||||||
|
});
|
||||||
// else menu.AddDisabledItem(new GUIContent("Paste"));
|
// else menu.AddDisabledItem(new GUIContent("Paste"));
|
||||||
menu.AddItem("Preferences", () => NodeEditorReflection.OpenPreferences());
|
menu.AddItem("Preferences", () => NodeEditorReflection.OpenPreferences());
|
||||||
menu.AddItem("创建所有的节点 ---> 测试用", () =>
|
menu.AddItem("创建所有的节点 ---> 测试用", () =>
|
||||||
@ -309,6 +315,8 @@ namespace XNodeEditor {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pos = NodeEditorWindow.current.WindowToGridPosition(menu.OpenBeforeMousePos);
|
||||||
|
|
||||||
for (int i = 0; i < NodeEditorReflection.nodeTypes.Length; i++)
|
for (int i = 0; i < NodeEditorReflection.nodeTypes.Length; i++)
|
||||||
{
|
{
|
||||||
Type type = NodeEditorReflection.nodeTypes[i];
|
Type type = NodeEditorReflection.nodeTypes[i];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user