| import { localStorageSetItem } from "@/Core/LocalStorage"; |
| import { setStoreVar } from "@/Store/StoreExternalAccess"; |
| import { GoldenLayout, Stack, Tab } from "golden-layout"; |
| import { layoutApi } from "@/Api/Layout"; |
| import { isMobile } from "@/Core/GlobalVars"; |
| export let goldenLayout: GoldenLayout; |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| export function makeGoldenLayout(glContainer: HTMLElement): GoldenLayout { |
| goldenLayout = new GoldenLayout(glContainer); |
| |
|
|
| |
| |
| |
| |
|
|
| |
| goldenLayout.on("tabCreated", (tab: Tab) => { |
| const tabElement = tab.element; |
| tabElement.addEventListener("dblclick", () => { |
| const parent = tab.contentItem.parent; |
| |
| if (parent && parent.isStack) { |
| (parent as Stack).toggleMaximise(); |
| } |
| }); |
| }); |
|
|
| goldenLayout.on("stateChanged", function () { |
| const state = goldenLayout.saveLayout(); |
| setStoreVar("goldenLayout", state); |
| |
| if (!isMobile && !layoutApi.isSessionLayoutActive()) { |
| localStorageSetItem("goldenLayoutState", state, undefined, false); |
| } |
| }); |
|
|
| return goldenLayout; |
| } |
|
|