public bool OnSelectEntry(SearchTreeEntry SearchTreeEntry, SearchWindowContext context) { var mousePosition = _window.rootVisualElement.ChangeCoordinatesTo(_window.rootVisualElement.parent, context.screenMousePosition - _window.position.position); var graphMousePosition = _graphView.contentViewContainer.WorldToLocal(mousePosition); switch (SearchTreeEntry.userData) { case Group group: var rect = new Rect(graphMousePosition, EasyGraphView.CommentGroupSize); _graphView.CreateCommentGroup(rect); return(true); case TriggerNode triggerNode: _graphView.CreateAndAddNode <TriggerNode>(graphMousePosition); return(true); case ConditionNode conditionNode: _graphView.CreateAndAddNode <ConditionNode>(graphMousePosition); return(true); case ActionNode actionNode: _graphView.CreateAndAddNode <ActionNode>(graphMousePosition); return(true); } return(false); }
private static void LoadCommentGroups(EasyGraphAsset easyGraphAsset, EasyGraphView easyGraphView) { foreach (var groupData in easyGraphAsset.commentGroupData) { var group = easyGraphView.CreateCommentGroup( new Rect(groupData.position, EasyGraphView.CommentGroupSize), groupData); group.AddElements(ExtractNodes(easyGraphView).Where(x => groupData.managedNodes.Contains(x.GUID))); } }