Skip to content
pixi-silk
GitHub repository
Function

applyDrop

import { applyDrop } from 'pixi-silk/ui/layers';
function applyDrop<T>(
   adapter: Required<Pick<TreeAdapter<T>, "getChildren" | "move">>, 
   nodes: readonly T[], 
   target: Pick<DropTarget<T>, "parent" | "index">, 
   parentOf: (node: T) => T | null
): MoveStep<T>[];

Moves nodes to a drop target through adapter.move, keeping their order, and returns the moves. Undo them with undoMoves. Nodes already in place are moved too, so the list replays the same way.

Type Parameters#

Type Parameter
T

Parameters#

ParameterType
adapterRequired<Pick<TreeAdapter<T>, "getChildren" | "move">>
nodesreadonly T[]
targetPick<DropTarget<T>, "parent" | "index">
parentOf(node: T) => T | null

Returns#

MoveStep<T>[]