I want to close/hide ContextMenu only when mouseClick is outside of contextMenu

Hi… all

I want to close contextMenu only when mouse click is outside of contextMenu region. if user do any action in side contextmenu then it should not hide.


can you(@walter ) help to find solution?

If your contextMenu is an Adornment, then it isn’t easy to customize the ContextMenuTool not to stop after a click in the context menu.

If you have implemented your own HTML context menus, as shown in HTML Context Menu and as cleaned up with the new HTMLInfo class in version 1.7, you can avoid making this call in your event handlers:


my contextMenu is an Adornment. then what is next?

If you really want it to be a context menu, implement it as an HTML context menu and don’t call stopTool until you want to.

Alternatively, don’t set GraphObject.contextMenu or Diagram.contextMenu, but instead implement GraphObject.contextClick or Diagram.contextClick event handlers. Then you can do whatever you want.

thank you :)