Esempio n. 1
0
        private void InitializeStage()
        {
            if (Element == null)
            {
                Element = new jQuery(".stage").First();
            }

            Element.Data("instance", this);
            Canvas = new StageCanvas(Element.Children(".canvas"));
            CenterScroll();
        }
Esempio n. 2
0
        public void RefreshTabHeader(jQuery tabElement)
        {
            jQuery pages  = tabElement.Children(".page");
            jQuery header = tabElement.Children("header");

            header.Remove("a");
            pages.Each((pid, page) =>
            {
                var jpage = new jQuery(page);
                header.Append($"<a href='' data-pageid='{jpage.Attr("data-pageid")}'>{jpage.Attr("data-page-title")}</a>");
            });

            jQuery active = tabElement.Children(".page.active");

            if (active.Length == 0)
            {
                active = pages.First();
            }
            ShowTab(tabElement, active);
        }
Esempio n. 3
0
        public static jQuery SetLastChild(this jQuery query, jQuery childElement)
        {
            var children = query?.Children();

            if (children == null || children.Length == 0)
            {
                childElement.AppendTo(query);
                return(query);
            }

            childElement.InsertAfter(children.Last());

            return(query);
        }
Esempio n. 4
0
        public void Mount(string tabId, jQuery docksite)
        {
            jQuery tab = docksite.Children($".tab[data-tabid='{tabId}']");

            if (tab.Length == 0)
            {
                tab = docksite.Append($"<div class='tab' data-tabid='{tabId}'><header></header></div>");
                tab.On("click", "header > a", new Action <MouseEvent>(OnClickTabHeader));
            }
            else
            {
                RefreshTabHeader(tab.First());
                tab.Off("click", "header > a");
                tab.On("click", "header > a", new Action <MouseEvent>(OnClickTabHeader));
            }
        }
        public DebugPointerToCanvas()
        {
            jQuery debug = new jQuery("#debugArea");

            EventManager.On <PointerDownSignal>(e =>
            {
                debug.Children(".pointer-event").Text("Down");
                debug.Children(".pointer-button").Text(Modifiers(e));
                debug.Children(".pointer-start").Text($"({e.StageX}, {e.StageY})");
                debug.Children(".pointer-end").Text($"n/a");
                debug.Children(".pointer-size").Text($"(0, 0)");
            });

            EventManager.On <PointerUpSignal>(e =>
            {
                debug.Children(".pointer-event").Text("Up");
                debug.Children(".pointer-button").Text(Modifiers(e));
                debug.Children(".pointer-start").Text($"({e.AnchoredStageX}, {e.AnchoredStageY})");
                debug.Children(".pointer-end").Text($"({e.StageX}, {e.StageY})");
                debug.Children(".pointer-size").Text($"({e.Width}, {e.Height})");
            });

            EventManager.On <PointerHoverSignal>(e =>
            {
                debug.Children(".pointer-event").Text("Hover");
                debug.Children(".pointer-button").Text(Modifiers(e));
                debug.Children(".pointer-start").Text($"({e.StageX}, {e.StageY})");
                debug.Children(".pointer-end").Text($"n/a");
                debug.Children(".pointer-size").Text($"n/a");
            });

            EventManager.On <PointerDragSignal>(e =>
            {
                debug.Children(".pointer-event").Text("Drag");
                debug.Children(".pointer-button").Text(Modifiers(e));
                debug.Children(".pointer-start").Text($"({e.AnchoredStageX}, {e.AnchoredStageY})");
                debug.Children(".pointer-end").Text($"({e.StageX}, {e.StageY})");
                debug.Children(".pointer-size").Text($"({e.Width}, {e.Height})");
            });

            EventManager.On <OnRegisterManagedActionEvent>(e =>
            {
                Console.Log($"Undo {e.ManagedAction.DisplayName}");
                jQuery undo = new jQuery("#main-menu-undo").Attr("title", $"Undo {e.ManagedAction.DisplayName}");
            });
        }
Esempio n. 6
0
        public static jQuery Foreach(this jQuery query, Action <jQuery> action)
        {
            query?.Children().Each((e, i) => action(new jQuery(e)));

            return(query);
        }
Esempio n. 7
0
 public void CloseTabs(jQuery tab)
 {
     tab.Children("header").Children(".active").RemoveClass("active");
     tab.Children(".active").RemoveClass("active");
 }
Esempio n. 8
0
 public void ShowTab(jQuery tab, jQuery page)
 {
     CloseTabs(tab);
     page.AddClass("active");
     tab.Children("header").Children($"a[data-pageid='{page.Attr("data-pageid")}']").AddClass("active");
 }