DiagramActionMediator
Defines an object that can decide at runtime whether a given shape should offer various actions in its shape editing tools. Each method in this interface is optional, and does not override any diagram-wide settings for the specific operation. Also, the mediator will not be invoked if a diagram is not editable.
Properties
canClone()?
optionalcanClone: (v,shape,el) =>boolean
Returns whether or not the given vertex should be clonable in the UI. Defaults to true, meaning the clone icon will be present in the diagram tools.
Parameters
v
shape
el
Returns
boolean
canCollapse()?
optionalcanCollapse: (group,currentSize) =>boolean|ObjectData
Returns whether or not the given group can be collapsed
Parameters
group
Group in question
currentSize
The group's current size.
Returns
boolean | ObjectData
Either a boolean value indicating the operation may or may not proceed, or a set of values. In the case that a set of values are returned, the operation is approved, and the data returned is updated onto the group's dataset. This is useful when your UI wants to stored specific information related to the collapsed group.
canDelete()?
optionalcanDelete: (v,shape,el) =>boolean
Returns whether or not the given vertex should be deletable in the UI. Defaults to true, meaning the delete icon will be present in the diagram tools when the vertex is selected.
Parameters
v
shape
el
Returns
boolean
canDrag()?
optionalcanDrag: (v,shape,el) =>boolean
Returns whether or not the given vertex should be draggable in the UI. Defaults to true.
Parameters
v
shape
el
Returns
boolean
canDrop()?
optionalcanDrop: (vertex,targetVertex?,isOnCanvas?) =>boolean
Returns whether or not the given vertex should be droppable on the given target, which may either be another vertex (if targetVertex is set), or the diagram canvas (if isOnCanvas is set). This method will never be called with both targetVertex set an isOnCanvas true - it's one or the other.
Parameters
vertex
targetVertex?
isOnCanvas?
boolean
Returns
boolean
canExpand()?
optionalcanExpand: (group,currentSize) =>boolean|ObjectData
Returns whether or not the given group can be expanded
Parameters
group
Group in question
currentSize
The group's current (collapsed) size.
Returns
boolean | ObjectData
Either a boolean value indicating the operation may or may not proceed, or a set of values. In the case that a set of values are returned, the operation is approved, and the data returned is updated onto the group's dataset. This is useful when your UI wants to stored specific information related to the expanded group.
canLink()?
optionalcanLink: (v,shape,el) =>boolean
Returns whether or not the given vertex should be linkable via edge drag in the UI. Defaults to true, meaning the link icon will be present in the diagram tools when the vertex is selected.
Parameters
v
shape
el
Returns
boolean
canResize()?
optionalcanResize: (v,shape,el) =>boolean
Returns whether or not the given vertex should be resizable in the UI. Defaults to true, meaning the resize handles will be present in the diagram tools when the vertex is selected.
Parameters
v
shape
el
Returns
boolean
canRotate()?
optionalcanRotate: (v,shape,el) =>boolean
Returns whether or not the given vertex should be resizable in the UI. Defaults to true, meaning the rotate handle and leader will be present in the diagram tools when the vertex is selected.
Parameters
v
shape
el
Returns
boolean