Ejemplo n.º 1
0
    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);
    }
Ejemplo n.º 2
0
 private void CreateNodes()
 {
     foreach (var nodeData in _containerCache.FrpNodeData)
     {
         var tempNode = NodeFactory.CreateNode(nodeData);
         _targetGraphView.AddElement(tempNode);
     }
 }