Skip to main content
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.
NameTypeDescription
canClone?(v:Node | Group, shape:ShapeType, el:BrowserElement) => booleanReturns 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.
canCollapse?(group:Group, currentSize:Size) => boolean | ObjectDataReturns whether or not the given group can be collapsed
canDelete?(v:Node | Group, shape:ShapeType, el:BrowserElement) => booleanReturns 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.
canDrag?(v:Node | Group, shape:ShapeType, el:BrowserElement) => booleanReturns whether or not the given vertex should be draggable in the UI. Defaults to true.
canDrop?(vertex:Node | Group, targetVertex:Node | Group, isOnCanvas:boolean) => booleanReturns 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.
canExpand?(group:Group, currentSize:Size) => boolean | ObjectDataReturns whether or not the given group can be expanded
canLink?(v:Node | Group, shape:ShapeType, el:BrowserElement) => booleanReturns 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.
canResize?(v:Node | Group, shape:ShapeType, el:BrowserElement) => booleanReturns 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.
canRotate?(v:Node | Group, shape:ShapeType, el:BrowserElement) => booleanReturns 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.