Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/components/SliceSlider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ export default {
computed: {
handlePosition() {
const range = this.max - this.min <= 0 ? 1 : this.max - this.min;
const pos = this.maxHandlePos * ((this.modelValue - this.min) / range);
// Invert mapping: lower slice numbers at bottom for anatomical consistency
const pos =
this.maxHandlePos * (1 - (this.modelValue - this.min) / range);
return this.dragging ? this.draggingHandlePos : pos;
},
draggingHandlePos() {
Expand Down Expand Up @@ -148,7 +150,8 @@ export default {
},

getNearestSlice(pos) {
const sliceEstimate = pos / this.maxHandlePos;
// Invert position: bottom of slider = lower slice numbers
const sliceEstimate = 1 - pos / this.maxHandlePos;
const frac = sliceEstimate * (this.max - this.min) + this.min;
return Math.round(frac / this.step) * this.step;
},
Expand Down
3 changes: 2 additions & 1 deletion src/components/vtk/VtkSliceViewSlicingManipulator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ const scroll = useMouseRangeManipulatorListener(
'scroll',
sliceConfig.range,
1,
sliceConfig.slice.value
sliceConfig.slice.value,
-1 // Invert scroll: scroll down = decrease slice for anatomical consistency
);

watch(scroll, () => {
Expand Down
6 changes: 4 additions & 2 deletions src/core/vtk/useMouseRangeManipulatorListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ export function useMouseRangeManipulatorListener(
type: ListenerType,
range: MaybeRef<Maybe<[number, number]>>,
step: MaybeRef<Maybe<number>>,
initialValue?: number
initialValue?: number,
scale: number = 1 // Negative scale inverts scroll direction
) {
const internalValue = ref(initialValue ?? 0);

Expand All @@ -37,7 +38,8 @@ export function useMouseRangeManipulatorListener(
() => internalValue.value,
(val) => {
internalValue.value = val;
}
},
scale
);

onCleanup(() => {
Expand Down
Loading