Which events are fired for items in Default HC context menu? How to disable the menu/these items?


Which events, if any, are fired for the following items in the default HC context menu (right-click menu)?

  • Show Handles
  • Reset Model
  • Unset Color
  • Modify Color
  • Transparent

We need to know when the model is being modified using these context menu items and what the specific modification is (nodes, transform, color, etc.).

If there is no way for us to get this information, is there a way to disable these items from the context menu? Is there a way to disable the entire popup menu?



unfortunately there is no official way to disable the standard context menu in the default UI other than not using the UI at all. I suggest you submit a feature request to add this functionality. If you want a hacky solution, simply search for “this._contextMenu=” and remove the two lines (one for the viewer context menu and one for the model tree context menu) from web_viewer_ui.js.

In general, if you need to know if certain functions in HC have been called and this information is not available as part of the official callbacks, you can simply override the relevant JS functions.
For example:

//call this on startup:
var resetNodesVisibilityOriginal = hwv.model.resetNodesVisibility; //we save the original function pointer 
hwv.model.resetNodesVisibility = resetNodesVisibilityCustom;

async function resetNodesVisibilityCustom() {
// perform your own custom logic

Again, I recommend to only use this approach if the existing callbacks are not sufficient.

Appreciate your prompt informative reply.

  1. Will file a feature request to turn off items in the default context menu, and to turn the entire menu off
  2. Using the handleEventEnd callback, am now able to get the new transform information to get the changes after Show Handles. (Was just using the handleEvent till now.)
  3. Trying to figure out how to implement the original/custom override you outlined in Angular/JS to call our resetNodesTransformCustom in lieu of this.hwv.model.resetNodesTransform().

The last three menu items (Unset Color, Modify Color and Transparent) don’t appear to have a callback. Do you have any idea which hwv functions are called for these so we can attempt a original/custom override?


Got the function names from ContextMenu.ts.

Here are the functions that are getting called for the menu items:

Unset Color: model.unsetNodesFaceColor()
Modify Color: model.setNodesFaceColor()
Transparent: model.setNodesTransparency()