Interface ShapeLibraryPaletteOptions<T>

Options for a shape library palette.

interface ShapeLibraryPaletteOptions<T> {
    allowClickToAdd?: boolean;
    autoExitDrawMode?: boolean;
    canvasStrokeWidth?: number;
    container: HTMLElement;
    dataGenerator?: DataGeneratorFunction<T>;
    dragSize?: Size;
    fill?: string;
    iconSize?: Size;
    initialSet?: string;
    mode?: DropManagerMode;
    onVertexAdded?: ((v, dropTarget?) => any);
    outline?: string;
    paletteStrokeWidth?: number;
    selectAfterDrop?: boolean;
    shapeLibrary: ShapeLibrary<T>;
    showAllMessage?: string;
    showLabels?: boolean;
    surface: Surface;
}

Type Parameters

  • T extends ObjectData

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)

autoExitDrawMode?: boolean

Defaults to true: when in 'tap' mode and a new group/node has been drawn on the canvas, the surface is set back to pan mode.

canvasStrokeWidth?: number

Stroke width to use for shapes dropped on canvas. Defaults to 2.

container: HTMLElement

The element to draw the palette into.

dataGenerator?: DataGeneratorFunction<T>

Optional data generator to allow you to specify initial data for some element to be dragged. Note that you cannot override the object's type with this function. The palette will set the new object's type to match the type of the element that the user is dragging from the palette.

dragSize?: Size

Optional size to use for dragged elements.

fill?: string

Optional fill color to use for dragged elements. This should be in RGB format, not a color like 'white' or 'cyan' etc.

iconSize?: Size

Optional size to use for icons. Defaults to 150x100 pixels. If you provide this but not dragSize this size will also be used for an icon that is being dragged.

initialSet?: string

Optional ID of the first set to show, hiding the others.

mode?: DropManagerMode

Mode to operate in - 'drag' or 'tap'. Defaults to 'drag' (DROP_MANAGER_MODE_DRAG).

onVertexAdded?: ((v, dropTarget?) => any)

Optional callback to invoke when a new vertex has been added

Type declaration

    • (v, dropTarget?): any
    • Parameters

      Returns any

outline?: string

Optional color to use for outline of dragged elements. Should be in RGB format.

paletteStrokeWidth?: number

Stroke width to use for shapes in palette. Defaults to 1.

selectAfterDrop?: boolean

When true (which is the default), a newly dropped vertex will be set as the underlying Toolkit's selection.

shapeLibrary: ShapeLibrary<T>

The shape library to render.

showAllMessage?: string

Message to use for the 'show all' option in the shape set drop down when there is more than one set of shapes. Defaults to Show all.

showLabels?: boolean

Optionally show each icon's label underneath it

surface: Surface

Surface to attach the drag/drop to.