meshcat-dev / meshcat

Remotely-controllable 3D viewer, built on top of three.js
MIT License
256 stars 48 forks source link

Make the datgui element a sibling of the meshcat-pane, not a child #62

Closed mfrigerio17 closed 5 years ago

mfrigerio17 commented 5 years ago

Sets the DOM element of the DAT.gui as a child of the parent of the meshcat pane, not a child of the meshcat pane itself.

This solves the issue that the camera orbit controls get triggered when playing with the gui controls. For example, when draggin a slider in the gui controls to change an integer parameter (not currently available in base meschat, though), the camera would also move, which might be annoying.

This works because the orbit controls are initialized by passing the meshcat-pane DOM element, thus they work only for that element (and the children).

I do not see any visual consequence of this change, so it looks good to me. But people with better knowledge of the code base might know of some cons.

rdeits commented 5 years ago

Sorry for missing this PR. I agree that having the dat elements interact with the camera control is annoying, and this seems like a good solution. Thanks!