Skip to main content

shapeIconClick

fires on clicking a toolbar icon

shapeIconClick: (id: string, event: MouseEvent) => void;

Parameters:

  • id: string | number - the id of the icon
  • event: MouseEvent - a native HTML event object

Example

const diagram = new dhx.Diagram("diagram_container", { 
toolbar: [
{
id:"download",
content:"<i className='zmdi zmdi-download'></i>"
},
{
id:"info",
content:"<i className='zmdi zmdi-info-outline'></i>"
}
]
});

diagram.events.on("shapeIconClick", function(icon){
const id = diagram.selection.getId();
alert(icon + " was clicked for id = " + id);
});