Skip to main content

elementTools

An element tool is a view that renders a certain type of control elements on top of the ElementView it is attached to; for example the Remove tool creates an interactive button above the element (this button then allow the user to remove the element). Element tools all inherit from the dia.ToolView class. A collection of tools is added to a ToolsView; a tools view is then added to the elementView with the linkView.addTools() function.

The JointJS library comes with a collection of pre-made element tool definitions in the joint.elementTools namespace. These tools can be used as they are or extended to create custom tools. You can find more information on how to use element tools in the correspondent learn section.

All of the built-in element tools accept the following optional argument, in addition to their own arguments:

focusOpacitynumberWhat should be the opacity of the tool when it is focused (e.g. with the toolView.focus function)? Default is undefined, meaning that the tool's opacity is kept unchanged.

Example:

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

const boundaryTool = new elementTools.Boundary({
focusOpacity: 0.5
});