TreeAdapter
import type { TreeAdapter } from 'pixi-silk/ui/layers';
How a LayerTree reads and changes your data. Only getChildren and getName are
required. The tree never holds its own copy of the data, so it can show a Pixi scene graph, a
document model or a state store.
Children come in display order: the first child is the top row, so list the front-most layer first.
Type Parameters#
| Type Parameter |
|---|
T |
Methods#
canHaveChildren()?#
optional canHaveChildren(node: T): boolean;
True when other nodes can be dropped inside. Default: when it has children.
Parameters#
| Parameter | Type |
|---|---|
node | T |
Returns#
boolean
getChildren()#
getChildren(node: T): readonly T[];
The children of node, in display order.
Parameters#
| Parameter | Type |
|---|---|
node | T |
Returns#
readonly T[]
getIcon()?#
optional getIcon(node: T): LayerIcon | null;
The icon of the row. Default none.
Parameters#
| Parameter | Type |
|---|---|
node | T |
Returns#
LayerIcon | null
getName()#
getName(node: T): string;
The name shown in the row.
Parameters#
| Parameter | Type |
|---|---|
node | T |
Returns#
string
getParent()?#
optional getParent(node: T): T | null;
The parent of node, or null for the root. Without it the tree searches from the root.
Parameters#
| Parameter | Type |
|---|---|
node | T |
Returns#
T | null
isLocked()?#
optional isLocked(node: T): boolean;
True when the node is locked. Without it, the row has no lock toggle.
Parameters#
| Parameter | Type |
|---|---|
node | T |
Returns#
boolean
isVisible()?#
optional isVisible(node: T): boolean;
True when the node shows. Without it, the row has no eye toggle.
Parameters#
| Parameter | Type |
|---|---|
node | T |
Returns#
boolean
move()?#
optional move(
node: T,
parent: T,
index: number
): void;
Moves node under parent at index in display order, counted without node itself.
Without it, rows cannot be dragged.
Parameters#
| Parameter | Type |
|---|---|
node | T |
parent | T |
index | number |
Returns#
void
setLocked()?#
optional setLocked(node: T, locked: boolean): void;
Sets the lock of node. Needed for the lock toggle to work.
Parameters#
| Parameter | Type |
|---|---|
node | T |
locked | boolean |
Returns#
void
setName()?#
optional setName(node: T, name: string): void;
Renames node. Without it, double click, Enter and F2 do nothing.
Parameters#
| Parameter | Type |
|---|---|
node | T |
name | string |
Returns#
void
setVisible()?#
optional setVisible(node: T, visible: boolean): void;
Shows or hides node. Needed for the eye toggle to work.
Parameters#
| Parameter | Type |
|---|---|
node | T |
visible | boolean |
Returns#
void