How to delete a node from context menu button

  1. The second argument, obj, will be the object on which the event handler is defined. In this case it will be the button, a Panel.

obj.part will be the “ContextMenu”, an Adornment.

obj.part.adornedPart will be the Node.

  1. You could perform the deletion by node.diagram.commit(d => d.remove(node)).
    Although that won’t raise the appropriate DiagramEvents, if you depend on them.
1 Like