WorkspaceLayoutMixin
Auto-generated from the @jbrowse/mobx-state-tree model in the source — see the developer guide for concepts. Built into JBrowse core. View source.
The whole workspace as one MST tree:
branch (a split) > panel (a grid cell) > tab > views (stacked)
Every action is tree -> tree through the pure functions in tree.ts, so
undo is applySnapshot on this node.
Properties
| Member | Description |
|---|---|
idid: types.identifier | |
viewIdsviewIds: types.array(types.string) | |
titletitle: types.maybe(types.string) | set only by an explicit rename; otherwise the name is derived from views |
idid: types.identifier | |
sizesize: types.optional(types.number, 1) | |
tabstabs: types.array(LayoutTab) | |
activeTabIdactiveTabId: types.maybe(types.string) | |
idid: types.identifier | |
sizesize: types.optional(types.number, 1) | |
| direction | |
| children | |
layoutlayout: types.optional(LayoutNode, emptyPanel) | |
activePanelIdactivePanelId: types.maybe(types.string) | |
maximizedPanelIdmaximizedPanelId: types.maybe(types.string) | Show only this cell, at the size of the whole workspace. Kept here rather than as a flag on PanelNode so no tree.ts operation has to say what it does to it. |
Getters
| Member | Description |
|---|---|
treeLayoutTree | Referentially stable, since getSnapshot is cached. Uncast on purpose: this assignment is what checks the models above agree with the interfaces in tree.ts. |
panelsPanelNode[] | |
tabsTabNode[] | |
visibleTreeLayoutTree | The maximized cell alone, or the whole tree. The cell is resized to 1 because CSS hands out free space by grow factor only up to a total of 1, so a third-of-a-row cell would draw a third of the window. |
Methods
| Member | Description |
|---|---|
hasPanel(panelId: string) => boolean | |
findTab(tabId: string) => TabHome | undefined | |
tabContainingView(viewId: string) => TabHome | undefined | |
panelContainingView(viewId: string) => PanelNode | undefined | |
viewIdsForTab(tabId: string, order: string[]) => string[] | The views a tab renders: its members, in session.views order. |
activeTabOf(panelId: string) => TabNode | undefined | The tab a panel is showing, or its first. |
Actions
| Member | Description |
|---|---|
setActivePanelId(panelId: string | undefined) => void | |
toggleMaximizedPanel(panelId: string) => void | Show one cell at the size of the workspace, or go back; naming a different cell moves the mode. Unmounts every other cell's views rather than hiding them, to stay under the WebGL2 context ceiling (agent-docs/reference/GPU_PORTABILITY.md). |
restorePanels() => void | |
setActiveTab(panelId: string, tabId: string) => void | |
renameTab(tabId: string, title: string | undefined) => void | |
| splitPanel | Split a grid cell; the new cell gets one empty tab. |
closePanel(panelId: string) => void | |
addTab(panelId: string, viewIds?: string[]) => TabNode | undefined | "New empty tab": a tab in an existing cell, showing the launcher. |
closeTab(tabId: string) => void | Close a tab, and its cell too if that was the last tab and not the workspace's last cell: a tabless cell renders nothing at all. |
addViewToTab(tabId: string, viewId: string) => void | |
| dropTabInPanel | Drop a dragged tab into an existing panel, as a tab. |
| dropTabInNewSplit | Drop a dragged tab on a panel edge: split, and land in the new half. |
setSizes(branchId: string, sizes: number[]) => void | |
applyLayoutSpec(spec: LayoutSpecNode<LayoutViewRef>) => string[] | Arrange the workspace as a spec states, in the shape a session spec's layout takes: a leaf's views names views by index into session.views or by id. A malformed leaf, an index past the end or an unknown id throws. |
| moveViewToNewTab | ViewMenu's "move to new tab": the view leaves its tab for a new one. allViewIds is EVERY view in the session, defaulting to the host's own list, since homing drops any view the list omits. |
| moveViewToSplit | ViewMenu's "move to split": the view leaves for a new cell to the right (row) or below (column) of its own. |
| moveViewToTab | ViewMenu's "move to tab": the view joins an existing tab, which becomes the one shown. |
homeUnassignedViews(viewIds: string[]) => void | |
| setPendingMove | Move one view to a new tab or a split beside its cell, keeping the rest of the arrangement. PUBLIC API: protein3d and msaview call it with the move alone, so allViewIds stays optional; it is read only on a host with no view list. |
tileViews(mode: TileMode, allViewIds: string[]) => void | Re-arrange the whole workspace, one view per cell, in one of four shapes. Pass allViewIds in session.views order so there is nothing for orderViews to apply. |
layoutViews(spec: LayoutSpecNode<LayoutViewRef>) => string[] | Arrange the session's views into panels: applyLayoutSpec, then session.views ordered to the spec's top-to-bottom order, which tabs read their order from. Leaves take view ids or indexes into session.views; a layout that seats no view throws rather than leaving a blank tab. A session spec's layout and an agent's live re-layout both call it. |