Skip to main content

ShapeType

Defines a shape type. If you wish to supply custom shape types you should extend this interface.

Properties

collapsedSize?

optional collapsedSize: Size

Size for this shape when it is collapsed - only relevant when objectType is Group.


collapsedTemplate?

optional collapsedTemplate: string

Template representing the shape when it is collapsed - only relevant when objectType is Group


defaultTarget?

optional defaultTarget: boolean

Defaults to true, meaning this will by default be treated as an edge target for drag/drop edges. In some cases you may not want the entire shape to be a target, for instance if its connectivity is to various ports (as an example, consider a logic gate with input pins and an output pin).


description?

optional description: string

Can be shown in a palette to give a user more information about a shape


font?

optional font: FontSpec

Optional shape-specific settings for font. This will override library wide font settings.


group?

optional group: string

Optional name of the group to which the shape belongs. This is not the same concept as a "group" inside the data model: this is a grouping of shape types, used to organise them in the UI.


icon?

optional icon: string

Optional icon to use in the shape palette instead of rendering the template.


initialSize?

optional initialSize: Size

Initial size for this specific shape. If not provided defaults will be used.


label?

optional label: string

Label to use for the shape type when displayed in a palette


labelPadding?

optional labelPadding: number

Optional label padding when labels are top/bottom to use for this shape type. The shape library will default to any labelPadding set on the shape set, or the system default.


labelPosition?

optional labelPosition: LabelPosition

Where to place the label for this type. Most shapes default to center but sometimes you might want to specify where a particular shape's label should be.


locked?

optional locked: boolean

For groups, indicates that the group is locked and no edits can occur to the child vertices. This is intended for use with the members option, for groups that gather a set of elements together to form a more complex building block. As an example in the real world, consider a Binary Adder: it is a group of logic gates whose relationships are fixed.


members?

optional members: GroupTemplate

Optional blueprint for child vertices and edges to be created when this group is added. Only relevant when objectType is Group.


mergeProperties?

optional mergeProperties: boolean

If true, instructs the inspector to merge this ShapeType's properties onto any defined by its ShapeSet.


objectType?

optional objectType: string

Defaults to Node.objectType. Indicates the object type - Node or Group - to create in the UI when a shape of this type is dragged.


payload?

optional payload: ObjectData

Optional initial payload to set on model objects that are dragged from a palette onto the canvas.


previewData?

optional previewData: ObjectData

Optional data to use when showing a preview of this shape - some shapes, such as Labels, will not display anything unless provided with a dataset. This config lets you provide the data that will be used when rendering a preview of the shape, for instance in a palette, or when drawing via the vertex drawing plugin.


properties?

optional properties: ShapePropertyDefinition[]

A list of configurable properties exposed by this shape's template. An inspector can read this array to automatically generate an editing UI.


template

template: string

Template representing the shape


type

type: string

The shape's type.