Interface VertexDrawingPluginOptions

Options for the vertex drawing plugin

interface VertexDrawingPluginOptions {
    allowClickToAdd?: boolean;
    autoExit?: boolean;
    defaultGroupSize?: Size;
    defaultNodeSize?: Size;
    groupType?: string;
    invert?: boolean;
    lassoClass?: string;
    minSize?: Size;
    nodeType?: string;
    typeGenerator?: VertexDrawingPluginTypeGenerator;
    vertexPreviewGenerator?: ((p, e) => BrowserElement);
    vertexPreviewUpdater?: ((p, size, el) => any);
}

Hierarchy (view full)

Properties

allowClickToAdd?: boolean

Defaults to false. When true, users can click on the canvas to "draw" a new element, and that element's size will use the default

autoExit?: boolean

When true (which is the default) the lasso exits after a group has been drawn

defaultGroupSize?: Size

Optional default size for groups, used when allowClickToAdd is set to true. Defaults to {w:250, h:250}

defaultNodeSize?: Size

Optional default size for nodes, used when allowClickToAdd is set to true. Defaults to {w:80, h:80}

groupType?: string

The type identifier for new groups. If you have also provided a typeGenerator this will be ignored. If you have not provided a typeGenerator but you have provided a nodeType, this will be ignored.

invert?: boolean

Defaults to false, meaning the lasso is drawn as a rectangle. If true, the lasso is drawn as a set of masks, with the lasso area drawn as a "hole" in the masks.

lassoClass?: string

Optional extra class(es) to set on the lasso used for drawing.

minSize?: Size

The minimum size for vertices. If your user draws a vertex smaller than this it will be discarded. Defaults to {w:50, h:50}

nodeType?: string

The type identifier for new nodes. If you have also provided a typeGenerator this will be ignored.

Optional function that will be invoked when a new drag commences, and which is responsible for returning the type of object to add (Node or Group), as well as that object's own type, and, optionally, an initial payload for the new object.

vertexPreviewGenerator?: ((p, e) => BrowserElement)

A function that will be invoked at the start of a drawing operation, and can return an element to draw into the lasso. This is an optional function; if you don't provide it JsPlumb will draw a basic SVG rectangle to indicate the drawing area.

Type declaration

    • (p, e): BrowserElement
    • Parameters

      Returns BrowserElement

vertexPreviewUpdater?: ((p, size, el) => any)

A function that is invoked during mouse drag, to be used in conjunction with vertexPreviewGenerator. This function gives you a hook to use to make any changes to your preview element, should you need to. This is optional.

Type declaration

    • (p, size, el): any
    • Parameters

      Returns any

Version :