Skip to content
pixi-silk
GitHub repository
Entry point

pixi-silk/ui/panel

Panel: a docked, scrolling side panel drawn on the canvas.

import { Panel, ScrollView, dockAt, dockRect } from 'pixi-silk/ui/panel';

Classes#

ClassDescription
PanelA panel drawn on the canvas, with no DOM: a title bar, a body that scrolls, edges to resize and a chevron that folds it. Drag the title bar to move it, and drop it near a screen edge to dock it there. Size, position and folding glide on springs. Text is SilkText.
ScrollViewA clipped area that scrolls its ScrollView.content up and down, the way a native list does. Wheels and trackpads glide to their target, fingers fling with momentum and stretch past the ends, and a slim scrollbar fades in while it moves.

Interfaces#

InterfaceDescription
PanelInsetsSpace kept free along each screen edge, such as a toolbar or another docked panel.
PanelOptionsOptions of Panel.
PanelRectA rectangle in the panel’s parent space.
PanelStateThe reactive state of a Panel.
PanelTextOptionsWhat the panels need to make a label.
PanelThemeColours and type of the editor panels. Every panel, the layer tree, the inspector and the minimap read the same tokens, so one theme restyles them all.
PanelViewportThe screen a panel docks in: numbers, or signals such as camera.state.width and height.
ScrollViewOptionsOptions of ScrollView.
ScrollViewStateThe reactive state of a ScrollView.

Type Aliases#

Type AliasDescription
PanelDockA screen edge or corner a panel docks to.

Variables#

VariableDescription
PANEL_THEMEThe dark default theme of every panel. Override single tokens with a panel’s theme option.
PANEL_THEME_LIGHTThe light theme. Pass it as theme, or spread it and change a few tokens.

Functions#

FunctionDescription
dockAtThe dock a drag points at: an edge or corner within distance of the pointer, or null. Corners win when both edges are near.
dockRectWhere a panel of size sits when docked to dock in a screen of viewport. Left and right panels span the height between the insets, top and bottom ones the width.
fitTextSets label to text, cut with three dots to fit width. Returns true when it was cut. Long names in narrow rows stay on one line.
panelHitTestA test for the camera’s ignore option: true for a point (in the stage’s space) over any of targets, so wheels and pans over panels stay with the panels.
panelTextA new SilkText label in the theme’s font, size and text colour.
resolvePanelThemeThe full theme for input: the dark default with input over it. Colours may be any Pixi colour.