Skip to main content
Version: 4.3

StencilApi

What useStencil returns: the underlying ui.Stencil view plus imperative drag controls (startCellDrag, cancelCellDrag). Provided through Stencil's React context, so call useStencil from any component rendered inside <Stencil>.

Properties

cancelCellDrag

readonly cancelCellDrag: (options?) => void;

Cancels the active drag (if any). The clone returns to the stencil.

Parameters

ParameterTypeDescription
options?{ dropAnimation?: DropAnimation; }Optional override for the drop animation.
options.dropAnimation?DropAnimationOverride the drop animation used when the clone returns to the stencil.

Returns

void


startCellDrag

readonly startCellDrag: (cell, event, options?) => void;

Programmatically starts dragging a cell or plain CellRecord from the stencil.

Parameters

ParameterTypeDescription
cell| Cell<Attributes<Selectors>, ModelSetOptions> | AnyCellRecordA dia.Cell instance or a plain CellRecord object: used as the drag preview.
event| Event | MouseEvent<Element, MouseEvent> | TouchEvent<Element>The originating mouse/touch event.
options?StartCellDragOptionsOptional per-drag overrides.

Returns

void


stencil

readonly stencil: StencilView;

The underlying JointJS ui.Stencil view (joint-react-plus's StencilView subclass).

Stay in the know

Be where thousands of diagramming enthusiasts meet

Star us on GitHub