Skip to content

Commit

Permalink
enh(track3dviewer): reset camera when relevant
Browse files Browse the repository at this point in the history
  • Loading branch information
bourdaisj committed Apr 23, 2024
1 parent b7c663a commit 275a436
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions client/src/components/track_3d_viewer/TrackViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -186,7 +186,9 @@ export default defineComponent({
renderer.value.addActor(cubeAxes);
}
drawCurrentFrameDetectionLabels();
if (resetCamera) {
renderer.value.resetCamera();
}
renderWindow.render();
}
}, 10);
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/track_3d_viewer/trackUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/track_3d_viewer/useTrackDrawer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ export default function useTrackDrawer({
showAllTracks();
}

viewUtils.rerender();
viewUtils.rerender(true);
};

const onFilteredAnnotationsChange = function onFilteredAnnotationsChange(
Expand Down

0 comments on commit 275a436

Please sign in to comment.