diff --git a/client/src/components/track_3d_viewer/TrackViewer.vue b/client/src/components/track_3d_viewer/TrackViewer.vue index 5131476a6..09bb85f07 100644 --- a/client/src/components/track_3d_viewer/TrackViewer.vue +++ b/client/src/components/track_3d_viewer/TrackViewer.vue @@ -174,7 +174,7 @@ export default defineComponent({ const cubeAxes = vtkCubeAxesActor.newInstance(); cubeAxes.setCamera(camera); - viewUtils.rerender = debounce(() => { + viewUtils.rerender = debounce((resetCamera = false) => { if (!renderWindow || renderWindow.isDeleted() || !renderer.value) { // pass } else { @@ -186,7 +186,9 @@ export default defineComponent({ renderer.value.addActor(cubeAxes); } drawCurrentFrameDetectionLabels(); - + if (resetCamera) { + renderer.value.resetCamera(); + } renderWindow.render(); } }, 10); diff --git a/client/src/components/track_3d_viewer/trackUtils.ts b/client/src/components/track_3d_viewer/trackUtils.ts index 98dc3403e..1de0542ce 100644 --- a/client/src/components/track_3d_viewer/trackUtils.ts +++ b/client/src/components/track_3d_viewer/trackUtils.ts @@ -3,7 +3,7 @@ import StyleManager from 'vue-media-annotator/StyleManager'; import * as vtkMath from '@kitware/vtk.js/Common/Core/Math'; export interface ViewUtils { - rerender: () => void; + rerender: (resetCamera?: boolean) => void; } export interface Feature { diff --git a/client/src/components/track_3d_viewer/useTrackDrawer.ts b/client/src/components/track_3d_viewer/useTrackDrawer.ts index 2d763745d..6f76908b5 100644 --- a/client/src/components/track_3d_viewer/useTrackDrawer.ts +++ b/client/src/components/track_3d_viewer/useTrackDrawer.ts @@ -391,7 +391,7 @@ export default function useTrackDrawer({ showAllTracks(); } - viewUtils.rerender(); + viewUtils.rerender(true); }; const onFilteredAnnotationsChange = function onFilteredAnnotationsChange(