All files / src/components/modal/actions Slice3dAction.vue

100% Statements 14/14
100% Branches 8/8
100% Functions 8/8
100% Lines 14/14

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89    2x                                         1x     10x   1x         1x                                                                     2x   2x   2x   2x 2x     2x   4x     2x 2x        
<template>
  <v-overlay
    v-model="menuState"
    data-testid="menu"
    location-strategy="connected"
    location="end"
    origin="top start"
    target="#volume"
    :scrim="false"
  >
    <template #activator="{ props }">
      <Action
        v-bind="props"
        :text="text"
        icon="cut"
        :variant="variant"
      />
    </template>
    <v-card
      class="px-8 py-4 overflow-hidden"
      width="300"
    >
      <DoubleSliderSelector
        v-model="tSlider"
        :label="t('enums.scanView.transverse')"
        v-bind="tMinMax"
      />
      <DoubleSliderSelector
        v-model="sSlider"
        :label="t('enums.scanView.sagittal')"
        v-bind="sMinMax"
      />
      <DoubleSliderSelector
        v-model="cSlider"
        :label="t('enums.scanView.coronal')"
        v-bind="cMinMax"
      />
    </v-card>
  </v-overlay>
</template>
 
<script setup lang="ts">
import { computed, ref } from 'vue';
import {
  cMinMax,
  cSlider,
  sMinMax,
  sSlider,
  tMinMax,
  tSlider,
} from '@/models/scanState';
import DoubleSliderSelector from '@/components/shared/DoubleSliderSelector.vue';
import { ScanView } from '@3cr/types-ts';
import { useI18n } from 'vue-i18n';
 
interface Props {
  view: ScanView;
  variant?: 'button' | 'menu-item';
}
 
type Emits = {
  'update:modal': [value: boolean];
};
 
withDefaults(defineProps<Props>(), {
  variant: 'button',
});
 
const emit = defineEmits<Emits>();
 
const { t } = useI18n();
 
const menu = ref<boolean>(false);
 
const text = computed(() => {
  return t('labels.slice');
});
 
const menuState = computed({
  get(): boolean {
    return menu.value;
  },
  set(value: boolean): void {
    menu.value = value;
    emit('update:modal', value);
  },
});
</script>