renderer.resetCamera() makes objects appear far when scene contains a line widget

All,

I’m using vtk.js to display cube and labels. For labels, I’m using LineWidgets without handlers.

Sometimes the user wants to refit the scene, ie. renderer.resetCamera is called. When the scene contains cubes only, all is ok. As soon as the scene contains a LineWidget, resetCamera makes objects appear far, ie. not the whole screen space is used.

See the example here. To reset the camera, right click in the scene.

When Lines 41 to 48 are removed, renderer.resetCamera works as expected.

Am I doing something wrong ?

1 Like

Widgets bounds are specified explicitly. To do so, you would call lineWidget.placeWidget(bounds), where the bounds could come from something in the scene (e.g. cube.getOutputData().getBounds()).

1 Like

Thank you Forrest, that was the missing piece !