new Vecta.Menu(shape, [index])
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.
| Name | Type | Attributes | Description | 
|---|---|---|---|
| shape | Vecta.Shape | The shape to add a menu to | |
| index | number | optional | The index of the menu. If undefined, create a custom menu, otherwise use the menu at the provided index. | 
 Methods
Methods
.action([action]) Returns: Vecta.Menu
Get or set the action to be performed when the menu is clicked.
| Name | Type | Attributes | Description | 
|---|---|---|---|
| action | string | optional | 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.
| Name | Type | Attributes | Description | 
|---|---|---|---|
| disable | string|boolean | optional | 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.
| Name | Type | Description | 
|---|---|---|
| index | number | 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.
| Name | Type | Attributes | Description | 
|---|---|---|---|
| select | string|boolean | optional | 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.
| Name | Type | Attributes | Description | 
|---|---|---|---|
| title | string | optional | Title of menu. Can be a valid JavaScript expression. | 
Returns:
Returns the Vecta.Menu object.