Skip to main content
Version: 4.1

Remove

The Remove element tool renders a remove button at a given position above the element. It accepts a few additional arguments, which can be passed as an object to the element tool constructor:

xstring | number

Use percentage strings (e.g. '40%') to position the button relatively to the element width/height. A number means distance from the top-left corner of the element. Default is 0.

y
rotatebooleanShould the button rotate according to the element angle around the element center? Default is false.
offsetobjectAdditional offset of the button from the position defined by x and y. Default is {x: 0, y: 0}.
actionfunction

What should happen when the user clicks the remove button? Default:

function(evt, elementView, toolView) {
elementView.model.remove({ ui: true, tool: toolView.cid });
}
markupJSONMarkupThe markup of the button, provided in the JointJS JSON format. Default is undefined (no content).
scalenumberScale the button up or down on a 2D plane. The default is 1.

Example:

import { elementTools } from '@joint/core';

const removeButton = new elementTools.Remove({
focusOpacity: 0.5,
rotate: true,
// top-mid
x: '50%',
y: '0%',
offset: { x: 10, y: 10 }
});