VertexDrawingPluginOptions
Options for the vertex drawing plugin
Extends
Properties
allowClickToAdd?
optionalallowClickToAdd:boolean
Defaults to false. When true, users can click on the canvas to "draw" a new element, and the plugin will use a default size for the element. When this flag is set, drag to add is still also enabled.
autoExit?
optionalautoExit:boolean
When true (which is the default) the lasso exits after a group has been drawn
clickToAddOnly?
optionalclickToAddOnly:boolean
Defaults to false. When true, the plugin only supports click to add new vertices, not drag. This flag is forced to true if the associated UI does not have useModelForSizes set, since there is no point in allowing a user to drag a vertex to some size if its not going to be honoured. When you set this flag and associated UI does have useModelForSizes set, the plugin will use default sizes for new nodes/groups.
defaultGroupSize?
optionaldefaultGroupSize:Size
Optional default size for groups, used when allowClickToAdd is set to true. Defaults to width and height of 250 pixels.
defaultNodeSize?
optionaldefaultNodeSize:Size
Optional default size for nodes, used when allowClickToAdd is set to true. Defaults to width and height of 80 pixels.
groupType?
optionalgroupType: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?
optionalinvert: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?
optionallassoClass:string
Optional extra class(es) to set on the lasso used for drawing.
minSize?
optionalminSize:Size
The minimum size for vertices. If your user draws a vertex smaller than this it will be discarded. Defaults to a width/height of 50 pixels.
nodeType?
optionalnodeType:string
The type identifier for new nodes. If you have also provided a typeGenerator this will be ignored.
onVertexAdded()?
optionalonVertexAdded: (v) =>any
Callback to invoke when a vertex has been added
Parameters
v
Returns
any
typeGenerator?
optionaltypeGenerator:VertexDrawingPluginTypeGenerator
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()?
optionalvertexPreviewGenerator: (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 VisuallyJs will draw a basic SVG rectangle to indicate the drawing area.
Parameters
p
e
MouseEvent
Returns
vertexPreviewUpdater()?
optionalvertexPreviewUpdater: (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.
Parameters
p
size
el
Returns
any