public bool OnSelectEntry(SearchTreeEntry searchTreeEntry, SearchWindowContext context) { var worldMousePosition = _window.rootVisualElement.ChangeCoordinatesTo(_window.rootVisualElement.parent, context.screenMousePosition - _window.position.position); var localMousePosition = _graphView.contentViewContainer.WorldToLocal(worldMousePosition); switch (searchTreeEntry.userData) { case Group group: var rect = new Rect(localMousePosition, _graphView.DefaultCommentBlockSize); _graphView.CreateCommentBlock(rect); return(true); case OperatorInfo info: _graphView.AddElement(NodeFactory.CreateNode(new FrpNodeData { CodeText = "Write code here", OperatorInfo = info, Position = localMousePosition, Guid = Guid.NewGuid().ToString() })); return(true); } return(false); }
private void GenerateCommentBlocks() { foreach (var commentBlock in CommentBlocks) { _targetGraphView.RemoveElement(commentBlock); } foreach (var commentBlockData in _containerCache.CommentBlockData) { var block = _targetGraphView.CreateCommentBlock( new Rect(commentBlockData.Position, _targetGraphView.DefaultCommentBlockSize), commentBlockData); block.AddElements(Nodes.Where(x => commentBlockData.ChildNodes.Contains(x.frpNodeData.Guid))); } }