private static void HandleNodeDragging(NodeEditorInputInfo inputInfo) { NodeEditorState state = inputInfo.editorState; if (state.dragNode) { if (state.selectedNode != null && GUIUtility.hotControl == 0) { state.dragOffset = inputInfo.inputPos - state.dragStart; state.selectedNode.rect.position = state.dragPos + state.dragOffset * state.zoom; NodeEditorCallbacks.IssueOnMoveNode(state.selectedNode); NodeEditor.RepaintClients(); } else { state.dragNode = false; } } }
public void LoadNodeCanvas(string path) { if (!File.Exists(path) || (nodeCanvas = NodeEditorSaveManager.LoadNodeCanvas(path, true)) == null) { NewNodeCanvas(); return; } editorState = NodeEditorSaveManager.ExtractEditorState(nodeCanvas, MainEditorStateIdentifier); openedCanvasPath = path; #if UNITY_EDITOR if (useCache) { SaveCache(); } #endif NodeEditor.RecalculateAll(nodeCanvas); NodeEditor.RepaintClients(); }
private static void HandleZooming(NodeEditorInputInfo inputInfo) { inputInfo.editorState.zoom = (float)Math.Round(Math.Min(6.0, Math.Max(0.6, inputInfo.editorState.zoom + inputInfo.inputEvent.delta.y / 15)), 2); NodeEditor.RepaintClients(); }
public void SaveNodeCanvas(string path) { nodeCanvas.editorStates = new NodeEditorState[] { editorState }; NodeEditorSaveManager.SaveNodeCanvas(path, nodeCanvas, true); NodeEditor.RepaintClients(); }
public void SetCanvas(NodeCanvas canvas) { nodeCanvas = canvas; editorState = NodeEditorSaveManager.ExtractEditorState(nodeCanvas, MainEditorStateIdentifier); NodeEditor.RepaintClients(); }