-
Notifications
You must be signed in to change notification settings - Fork 142
Description
I was looking to override the default "clickPick-left" and "hoverPick" feature in the NGLwidget and add customized mouse actions, like "when left mouse is clicked on an atom, it will show a highlight representation"
I am trying this on Jupyter notebook, however, when I do this override using the Javascript code
view = nv.NGLWidget()
view._js("""
this.stage.signals.componentAdded.add((component) => {
// remove default hover/click pick
this.stage.mouseControls.remove("hoverPick");
this.stage.mouseControls.remove("clickPick-left");
});
""")
and then add new components in the widget, it removes the default controls .
However,
in a different cell, if I add new component and try to update the widget and view it
view.update_representation()
view
The override is gone and default mouseControls are observed, like clicking with left mouse, centers the atom, etc.
How do I make sure that NGLwidget can get updated with the addition of new components,
but I can remove the default mouse controls just once and it does not get updated to default the next time, I try to view the NGLwidget?