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

**URL:** https://discourse.vtk.org/t/renderer-resetcamera-makes-objects-appear-far-when-scene-contains-a-line-widget/7579
**Category:** Web
**Created:** [January 6, 2022, 3:22pm UTC](https://discourse.vtk.org/t/renderer-resetcamera-makes-objects-appear-far-when-scene-contains-a-line-widget/7579 "2022-01-06T15:22:02Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![toro](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/58f4c7/32.png) [@toro](https://discourse.vtk.org/u/toro)
#### Post date: [January 6, 2022, 3:22pm UTC](https://discourse.vtk.org/t/renderer-resetcamera-makes-objects-appear-far-when-scene-contains-a-line-widget/7579/1 "2022-01-06T15:22:02Z")

</div>

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](https://codesandbox.io/embed/vtk-js-volume-rendering-forked-nk3q1?fontsize=14&hidenavigation=1&theme=dark). 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 ?

---

<div class="post-metadata">

### Author: ![Forrest](https://discourse.vtk.org/user_avatar/discourse.vtk.org/forrest/32/300_2.png) [@Forrest](https://discourse.vtk.org/u/Forrest)
#### Post date: [January 6, 2022, 6:26pm UTC](https://discourse.vtk.org/t/renderer-resetcamera-makes-objects-appear-far-when-scene-contains-a-line-widget/7579/2 "2022-01-06T18:26:01Z")

</div>

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()`).

---

<div class="post-metadata">

### Author: ![toro](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/58f4c7/32.png) [@toro](https://discourse.vtk.org/u/toro)
#### Post date: [January 7, 2022, 9:59am UTC](https://discourse.vtk.org/t/renderer-resetcamera-makes-objects-appear-far-when-scene-contains-a-line-widget/7579/3 "2022-01-07T09:59:01Z")

</div>

Thank you Forrest, that was the missing piece !
