private void InitializeStage() { if (Element == null) { Element = new jQuery(".stage").First(); } Element.Data("instance", this); Canvas = new StageCanvas(Element.Children(".canvas")); CenterScroll(); }
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); }
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); }
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}"); }); }
public static jQuery Foreach(this jQuery query, Action <jQuery> action) { query?.Children().Each((e, i) => action(new jQuery(e))); return(query); }
public void CloseTabs(jQuery tab) { tab.Children("header").Children(".active").RemoveClass("active"); tab.Children(".active").RemoveClass("active"); }
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"); }