Skip to content

@whittakertech/mosaic / DragContext

Interface: DragContext

Defined in: drag/context.ts:20

Immutable context object describing the current drag operation.

A DragContext provides a stable, serializable view of MosaicJS’s internal drag state at a specific moment in time.

It is passed to lifecycle hooks and emitted with relevant events to allow external systems to observe drag behavior safely.

Remarks

  • A DragContext is read-only and frozen at creation time.
  • It represents a snapshot of state, not a live reference.
  • Consumers must not attempt to mutate or persist this object.

The shape of DragContext is considered part of MosaicJS’s stable public API.

Properties

activeNodeId

ts
readonly activeNodeId: string | null;

Defined in: drag/context.ts:25

Currently dragged node ID, or null when idle


dropTargetId

ts
readonly dropTargetId: string | null;

Defined in: drag/context.ts:28

Resolved drop target node ID, or null when none


hasSnapshot

ts
readonly hasSnapshot: boolean;

Defined in: drag/context.ts:40

Whether a drag snapshot currently exists


mosaicRootId

ts
readonly mosaicRootId: string;

Defined in: drag/context.ts:22

Root Mosaic instance identifier


pointer

ts
readonly pointer: object;

Defined in: drag/context.ts:31

Pointer position at time of emission

x

ts
readonly x: number;

y

ts
readonly y: number;

state

ts
readonly state: MosaicState;

Defined in: drag/context.ts:37

Current Mosaic drag lifecycle state