From 44458690358c05e27a8f8e7abba1b2327e4fcb93 Mon Sep 17 00:00:00 2001 From: Paul Elliott Date: Fri, 14 Aug 2026 23:46:44 +0000 Subject: [PATCH 1/2] chore(types): drop the vtk.js ambient shims src/shims-vtk.d.ts existed because vtk.js shipped no declarations for these entry points. Upstream now declares all of them, so the file is removed entirely and the code uses the real types. Some of the shim was also stale and was quietly hiding drift: - vtkWidgetManager declared updateSelectionFromXY, updateSelectionFromMouseEvent and useSvgLayer, none of which still exist upstream - the reslice cursor state claimed setColor3/setScale1/setOpacity on the root state, but those live on the individual handle states; the casts in ResliceCursorTool now name the mixin state types they really are - a non-generic addWidget signature masked that our own vtkPaintWidget and vtkCrosshairsWidget declarations extended the factory's value type rather than its interface Preset metadata specific to VolView (OpacityPoints, AbsoluteRange, EffectiveRange) moves to a local ColorMapPreset type extending vtk.js's IColorMapPreset, instead of a shim redeclaring the whole module. --- src/components/ObliqueSliceViewer.vue | 9 +- src/components/tools/ResliceCursorTool.vue | 30 +- src/composables/useVolumeThumbnailing.ts | 4 +- src/shims-vtk.d.ts | 310 --------------------- src/store/reslice-cursor.ts | 8 +- src/types/color-map-preset.ts | 26 ++ src/utils/vtk-helpers.ts | 10 +- src/vtk/ColorMaps.ts | 5 +- src/vtk/CrosshairsWidget/index.d.ts | 4 +- src/vtk/PaintWidget/index.d.ts | 4 +- src/vtk/PaintWidget/state.ts | 6 +- 11 files changed, 74 insertions(+), 342 deletions(-) delete mode 100644 src/shims-vtk.d.ts create mode 100644 src/types/color-map-preset.ts diff --git a/src/components/ObliqueSliceViewer.vue b/src/components/ObliqueSliceViewer.vue index 60b17faef..492acff73 100644 --- a/src/components/ObliqueSliceViewer.vue +++ b/src/components/ObliqueSliceViewer.vue @@ -145,10 +145,15 @@ watchEffect(() => { // setup plane origin/normal const planeOrigin = vtkFieldRef(resliceCursorState, { get: () => resliceCursorState.getCenter(), - set: (v) => resliceCursor.setCenter(v), + set: (v) => { + resliceCursor.setCenter(v); + return true; + }, }); const planes = vtkFieldRef(resliceCursorState, 'planes'); -const planeNormal = computed(() => planes.value[widgetViewType.value].normal); +// The reslice cursor is created with the default X/Y/Z planes, so the entry +// for this view's type is always present. +const planeNormal = computed(() => planes.value[widgetViewType.value]!.normal); // slicing domain/range diff --git a/src/components/tools/ResliceCursorTool.vue b/src/components/tools/ResliceCursorTool.vue index eeb4258c4..26cde5722 100644 --- a/src/components/tools/ResliceCursorTool.vue +++ b/src/components/tools/ResliceCursorTool.vue @@ -1,9 +1,17 @@