示例#1
0
        public LokiFlowPort(Orientation portOrientation, Direction portDirection, Capacity capacity,
                            string name = "Unnamed Port") : base(portOrientation, portDirection, capacity, name)
        {
            var ss = LokiResources.Get <StyleSheet>("StyleSheets/LokiFlowPort.uss");

            styleSheets.Add(ss);

            defaultColor = new Color(0f, 0.62f, 0.79f, 0.82f);
            color        = defaultColor;

            generateVisualContent += OnGenerateVisualContent;
        }
示例#2
0
 public LokiEdge()
 {
     styleSheets.Add(LokiResources.Get <StyleSheet>("StyleSheets/LokiEdge.uss"));
     capabilities          |= Capabilities.Selectable | Capabilities.Deletable;
     usageHints             = UsageHints.DynamicTransform;
     generateVisualContent += OnGenerateVisualContent;
     RegisterCallback <MouseEnterEvent>(OnMouseEnter);
     RegisterCallback <MouseLeaveEvent>(OnMouseLeave);
     RegisterCallback <AttachToPanelEvent>(OnAttachToPanel);
     RegisterCallback <DetachFromPanelEvent>(OnDetachFromPanel);
     this.AddManipulator(new ContextualMenuManipulator(OnContextMenuPopulate));
 }
示例#3
0
        public LokiNodeView(LokiNodeAdapter adapter)
        {
            this.adapter = adapter;

            var visualTree = LokiResources.Get <VisualTreeAsset>("UXML/LokiNodeView.uxml");

            visualTree.CloneTree(this);

            var styleSheet = LokiResources.Get <StyleSheet>("StyleSheets/LokiNodeView.uss");

            styleSheets.Add(styleSheet);

            this.AddToClassList("node");

            capabilities |= Capabilities.Selectable | Capabilities.Movable | Capabilities.Deletable |
                            Capabilities.Ascendable | Capabilities.Copiable;
            usageHints = UsageHints.DynamicTransform;

            style.position = Position.Absolute;

            selectionBorder = this.Q <VisualElement>("selection-border");
            container       = this.Q <VisualElement>("node-root");

            headerContainer = this.Q <VisualElement>("header-container");
            midContainer    = this.Q <VisualElement>("mid-container");

            titleLabel = headerContainer.Q <Label>("title");


            container.RegisterCallback <GeometryChangedEvent>(OnRootGeometryChanged);

            this.RegisterCallback <MouseEnterEvent>(OnMouseEnter);
            this.RegisterCallback <MouseLeaveEvent>(OnMouseLeave);

            adapter.BuildNodeView(this);
        }