コード例 #1
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);
        }
コード例 #2
0
        public static LokiNodeView Get(LokiNodeAdapter adapter)
        {
            var nodeView = new LokiNodeView(adapter);

            return(nodeView);
        }