private void OnGUI() { GUI.Box(new Rect(0, 0, position.width, 20), ""); _currentRoot = (VisualNodeRoot)EditorGUILayout.ObjectField(_currentRoot, typeof(VisualNodeRoot)); if (_currentRoot == null) { GUILayout.Label("There is no VisualNodeRoot selected."); return; } if (_currentRoot.root == null) { if (GUI.Button(new Rect(0, 20, 100, 16), "Add root node")) { new VisualNodeEditorContextMenu(AddNodeToRoot).ShowMenu(); } return; } if (Event.current.isScrollWheel) { zoomScale += Event.current.delta.y / 100; if (zoomScale <= .1f) { zoomScale = .1f; } } if (Event.current.keyCode == KeyCode.R) { editorZoomArea.ResetZoom(); Event.current.Use(); } //Begin scroll view fullEditorSize.width += 50; fullEditorSize.height += 50; editorZoomArea.Begin(new Rect(0, 20, position.width, position.height), fullEditorSize); fullEditorSize.xMax = 0; fullEditorSize.yMax = 0; DrawNodesConnections(); DrawNodeWindows(); editorZoomArea.End(); ConnectingToParentEventCheck(); HandleContextClick(); HandleScrollDrag(); }
private void OnSelectionChange() { editorZoomArea.ResetZoom(); Repaint(); }