ohra
ohra

Reputation: 506

Disable context menu in Forge Viewer

I have a tool which when activated would need to deactivate the viewer's context menu, specifically that it does not appear on press and hold touch events.

Is there a way to deactivate and later reactivate the context menu or can I listen to the touch events and stop them from propagating to whatever launches the context menu?

Upvotes: 0

Views: 237

Answers (1)

Bryan Huang
Bryan Huang

Reputation: 5342

The context menu instance is exposed via viewer.contextMenu and you can call shots on it like below:

viewer.contextMenu.hide();
viewer.contextMenu.show(PointerEvent);

var contextMenu = viewer.contextmenu;
viewer.setContextMenu(null); //deactivate context menu
viewer.setContextMenu(contextMenu); //reactivate context menu

Upvotes: 1

Related Questions