Menu

Vecta.Menu

Vecta menu object. Wrapper for a custom menu that can be attached to shapes. The custom menu will be shown on the right-click menu of the shape.

NameTypeAttributesDescription
shapeVecta.Shape

The shape to add a menu to

indexnumberoptional

The index of the menu. If undefined, create a custom menu, otherwise use the menu at the provided index.

Methods

.action([action]) Returns: Vecta.Menu

Get or set the action to be performed when the menu is clicked.

NameTypeAttributesDescription
actionstringoptional

A valid JavaScript expression.

Returns:

Returns the Vecta.Menu object.

.delete()

Delete the custom menu.

.disable([disable]) Returns: Vecta.Menu

Get or set menu to be disabled.

NameTypeAttributesDescription
disablestring|booleanoptional

Undefined to get if the menu is disabled.

A valid Javascript expression that evaluates to true or false, to set menu to disabled.

Returns:

Returns the Vecta.Menu object.

.reIndex(index) Returns: Vecta.Menu

Reorder the menu.

NameTypeDescription
indexnumber

The index of the menu to be placed.

Returns:

Returns the Vecta.Menu object.

.select([select]) Returns: Vecta.Menu

Get or set the selected status of the menu object.

NameTypeAttributesDescription
selectstring|booleanoptional

Undefined to get the selected status of the menu.

A valid Javascript expression that evaluates to true or false, to set menu selected status.

Returns:

Returns the menu option

.separator() Returns: Promise.<boolean>

Evaluate the menu if it has separator.

Returns:

Returns promise that resolves the existence of separator in menu

.title([title]) Returns: Vecta.Menu

Get or set the title of menu.

NameTypeAttributesDescription
titlestringoptional

Title of menu. Can be a valid JavaScript expression.

Returns:

Returns the Vecta.Menu object.

vecta.io Early Access