Esempio n. 1
0
        public void NotifyDragAction(UIBrowserTreeNode src, UIElement dest)
        {
            var basep = src.DisplayElement.BindingElement.PositionScreen;

            if (dest is BrowserTreeDisplayNode)
            {
                BrowserTreeDisplayNode dest2 = (BrowserTreeDisplayNode)dest;
                if (src == dest2.Info)
                {
                    return;
                }
                dest2.Info.AddChildTreeNode(src);
            }
            else if (dest == _viewPort)
            {
                if (src.InfoParent != null)
                {
                    src.InfoParent.RemoveChildTreeNode(src);
                    src.InfoParent = null;
                }
                else
                {
                    RemoveTreeRoot(src);
                }
                Editor.Viewer.Canvas.Root.AppendChild(src.DisplayElement.BindingElement);
                AddElement(src);
            }
            src.DisplayElement.BindingElement.Position = src.DisplayElement.BindingElement.ScreenPositionToParentAR(basep);
            src.DisplayElement.BindingElement.Recalculate();
            Editor.NotifySelectionChange();
        }
Esempio n. 2
0
        public UIBrowserTreeNode(string text, UIElement element, IList <UIBrowserTreeNode> nodes) : base()
        {
            Pivot = new Vector2(0, 0);
            var display = new BrowserTreeDisplayNode(text, element, this)
            {
                Pivot       = new Vector2(0f, 0f),
                AnchorPoint = new Vector2(0f, 0f),
                SizeFactor  = new Vector2(1f, 0f),
                Size        = new Vector2(0f, 30f),
            };

            DisplayElement = display;
            TreeNodes      = nodes;
            foreach (var node in nodes)
            {
                node.InfoParent = this;
            }
        }