Skip to content
pixi-silk
GitHub repository
Function

flattenTree

import { flattenTree } from 'pixi-silk/ui/layers';
function flattenTree<T>(
   adapter: Pick<TreeAdapter<T>, "getChildren">, 
   root: T, 
   isExpanded: (node: T) => boolean, 
   showRoot?: boolean
): FlatRow<T>[];

Lists the visible rows of a tree, depth first: the children of root (or root itself with showRoot), and the children of every expanded node under them.

Type Parameters#

Type Parameter
T

Parameters#

ParameterTypeDefault value
adapterPick<TreeAdapter<T>, "getChildren">undefined
rootTundefined
isExpanded(node: T) => booleanundefined
showRootbooleanfalse

Returns#

FlatRow<T>[]