From deaa77cb5217c6297763c244a83e48b8adefb929 Mon Sep 17 00:00:00 2001 From: Laurent Chauvin Date: Wed, 11 Sep 2024 12:04:55 -0400 Subject: [PATCH 1/2] feat(camera): Add option to disable camera auto reset --- src/components/Settings.vue | 13 +++++++++++++ src/components/SliceViewer.vue | 4 ++++ src/components/vtk/VtkSliceView.vue | 13 +++++++------ src/components/vtk/VtkVolumeView.vue | 12 ++++++------ src/store/view-configs/camera.ts | 10 +++++++++- 5 files changed, 39 insertions(+), 13 deletions(-) diff --git a/src/components/Settings.vue b/src/components/Settings.vue index 016780231..dea3e2288 100644 --- a/src/components/Settings.vue +++ b/src/components/Settings.vue @@ -10,6 +10,14 @@ hide-details > + + import { defineComponent, ref, watch } from 'vue'; +import { storeToRefs } from 'pinia'; import { useTheme } from 'vuetify'; import { useLocalStorage } from '@vueuse/core'; @@ -50,6 +59,7 @@ import { useErrorReporting, errorReportingConfigured, } from '../utils/errorReporting'; +import { useViewCameraStore } from '@/src/store/view-configs/camera'; export default defineComponent({ setup() { @@ -68,6 +78,8 @@ export default defineComponent({ errorReportingStore.disableReporting = !enabled; }); + const { disableCameraAutoReset } = storeToRefs(useViewCameraStore()); + const keyboardStore = useKeyboardShortcutsStore(); const openKeyboardShortcuts = () => { keyboardStore.settingsOpen = true; @@ -78,6 +90,7 @@ export default defineComponent({ reportingEnabled, errorReportingConfigured, openKeyboardShortcuts, + disableCameraAutoReset, }; }, components: { diff --git a/src/components/SliceViewer.vue b/src/components/SliceViewer.vue index d7066bdd2..2c6c228cd 100644 --- a/src/components/SliceViewer.vue +++ b/src/components/SliceViewer.vue @@ -33,6 +33,7 @@ class="vtk-view" ref="vtkView" data-testid="vtk-view vtk-two-view" + :disable-auto-reset-camera="disableCameraAutoReset" :view-id="id" :image-id="currentImageID" :view-direction="viewDirection" @@ -172,6 +173,7 @@ import SliceSlider from '@/src/components/SliceSlider.vue'; import SliceViewerOverlay from '@/src/components/SliceViewerOverlay.vue'; import { useToolSelectionStore } from '@/src/store/tools/toolSelection'; import { useAnnotationToolStore, useToolStore } from '@/src/store/tools'; +import { useViewCameraStore } from '@/src/store/view-configs/camera'; import { doesToolFrameMatchViewAxis } from '@/src/composables/annotationTool'; import { useWebGLWatchdog } from '@/src/composables/useWebGLWatchdog'; import { useSliceConfig } from '@/src/composables/useSliceConfig'; @@ -192,6 +194,8 @@ const vtkView = ref(); const props = defineProps(); +const { disableCameraAutoReset } = storeToRefs(useViewCameraStore()); + const { id: viewId, type: viewType, viewDirection, viewUp } = toRefs(props); const viewAxis = computed(() => getLPSAxisFromDir(viewDirection.value)); diff --git a/src/components/vtk/VtkSliceView.vue b/src/components/vtk/VtkSliceView.vue index 2a0a2f54c..4a0393cef 100644 --- a/src/components/vtk/VtkSliceView.vue +++ b/src/components/vtk/VtkSliceView.vue @@ -1,5 +1,6 @@