Exemple #1
0
        private void CreateGroups()
        {
            graphObject.CodeGraphData.Groups.ForEach(groupData => {
                var group = new Group {
                    title = groupData.Title
                };
                graphObject.CodeGraphData.AddGroup(groupData);
                groupData.GroupReference = group;

                graphView.GroupDictionary.Add(group, groupData);
                graphView.GroupGuidDictionary.Add(groupData.Guid, groupData);
                graphView.AddElement(group);
            });
        }
Exemple #2
0
        public bool OnSelectEntry(SearchTreeEntry entry, SearchWindowContext context)
        {
            var nodeEntry           = (NodeEntry)entry.userData;
            var nodeType            = nodeEntry.NodeType;
            var node                = (AbstractNode)Activator.CreateInstance(nodeType);
            var windowMousePosition = editorWindow.rootVisualElement.ChangeCoordinatesTo(editorWindow.rootVisualElement.parent, context.screenMousePosition - editorWindow.position.position);
            var graphMousePosition  = graphView.contentViewContainer.WorldToLocal(windowMousePosition);

            var nodePosition = new Vector2(graphMousePosition.x, graphMousePosition.y);

            node.SetPosition(new Rect(nodePosition, AbstractNode.DefaultNodeSize));
            node.OnCreateFromSearchWindow(nodePosition);
            graphView.AddElement(node);
            return(true);
        }