Interface DropManagerOptions<T>

Options for the DropManager.

interface DropManagerOptions<T> {
    allowClickToAdd?: boolean;
    dragSize?: Size;
    ignoreConstrainFunction?: boolean;
    ignoreZoom?: boolean;
    lassoClass?: string;
    mode?: DropManagerMode;
    selector: string;
    source: Element;
    surface: Surface;
    vertexPreviewGenerator?: ((objectType, type, data, p, e) => BrowserElement);
    vertexPreviewUpdater?: ((el, origin, size, data) => any);
}

Type Parameters

  • T

Properties

allowClickToAdd?: boolean

When in tap mode, allow addition of new vertices simply by clicking, instead of requiring a shape be drawn. (When this is true, the drawing method also still works)

dragSize?: Size

Optional dimensions to use for elements being dragged.

ignoreConstrainFunction?: boolean

If true, the manager will ignore any element constrain function that may be set on the surface

ignoreZoom?: boolean

By default, the DropManager will apply a scale transform to elements that are being dragged so that they appear at the same size as the Surface they're being dragged to. Setting this flag to true will switch off that behaviour.

lassoClass?: string

When in 'tap' mode, you can optionally provide a class to set on the lasso used by the vertex drawing plugin.

mode?: DropManagerMode

Mode to operate in - 'drag' or 'tap'. Defaults to 'drag'.

selector: string

A selector that identifies the draggable elements inside source.

source: Element

The element that contains draggable elements.

surface: Surface

The Surface to attach to. Required.

vertexPreviewGenerator?: ((objectType, type, data, p, e) => BrowserElement)

When in tap mode, this function can be used to provide the element shown to the user as a new vertex is being drawn.

Type declaration

    • (objectType, type, data, p, e): BrowserElement
    • Parameters

      • objectType: string

        Group or Node

      • type: string

        The type will map to an item in your view

      • data: T

        The return value from the dataGenerator

      • p: PointXY

        Location on the canvas where the mousedown event occurred.

      • e: MouseEvent

        Mouse down event

      Returns BrowserElement

vertexPreviewUpdater?: ((el, origin, size, data) => any)

When in tap mode this function is repeatedly called as the mouse is dragging a new shape. It provides a hook for you to update the element's appearance.

Type declaration

    • (el, origin, size, data): any
    • Parameters

      Returns any