All files / src/components/navigation/measurement MeasurementIcon.vue

0% Statements 0/18
0% Branches 0/12
0% Functions 0/2
0% Lines 0/18

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                                                                                           
<template>
  <v-icon
    :icon="icon"
    :color="color"
    size="20"
  />
</template>
 
<script setup lang="ts">
import { computed } from 'vue';
import { isDataOverlayLength } from '@/functions/guards/isDataOverlayLength';
import { isDataOverlayAngle } from '@/functions/guards/isDataOverlayAngle';
import { isDataOverlayPolygon } from '@/functions/guards/isDataOverlayPolygon';
import { DataOverlayMeasurement } from '@3cr/viewer-types-ts';
 
interface Props {
  measurement: DataOverlayMeasurement;
}
 
const props = defineProps<Props>();
 
const color = computed(() => {
  if (isDataOverlayLength(props.measurement)) {
    return 'green';
  } else if (isDataOverlayPolygon(props.measurement)) {
    return 'red';
  } else if (isDataOverlayAngle(props.measurement)) {
    return 'blue';
  } else {
    return 'white';
  }
});
 
const icon = computed(() => {
  if (isDataOverlayLength(props.measurement)) {
    return 'filled:straighten';
  } else if (isDataOverlayPolygon(props.measurement)) {
    return 'filled:polyline';
  } else if (isDataOverlayAngle(props.measurement)) {
    return 'filled:square_foot';
  } else {
    return 'question_mark';
  }
});
</script>