Skip to content

@whittakertech/mosaic / buildDragContext

Function: buildDragContext()

ts
function buildDragContext(params): DragContext;

Defined in: drag/context.ts:60

Constructs an immutable DragContext from internal drag state.

This function is used by MosaicJS to create the context object passed to lifecycle hooks and emitted with drag-related events.

Parameters

params

Internal drag state used to populate the context

activeNodeId

string | null

dropTargetId

string | null

hasSnapshot

boolean

mosaicRootId

string

pointer

{ x: number; y: number; }

pointer.x

number

pointer.y

number

state

MosaicState

Returns

DragContext

A frozen DragContext representing the current drag state

Remarks

  • The returned object is frozen and must not be mutated.
  • The context represents a snapshot in time, not a live reference.

While exported as part of the public API, this function is primarily intended for internal use and advanced tooling.