LCOV - code coverage report
Current view: top level - src/extensions/core/load3d/components/menubar - ModelMenuGroup.vue Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 5.6 % 18 1
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1           13 : <template>
       2              :   <PopoverRoot v-model:open="upDirectionOpen">
       3              :     <PopoverTrigger as-child>
       4              :       <Button
       5              :         variant="textonly"
       6              :         size="unset"
       7              :         :tooltip="t('load3d.menuBar.upDirection')"
       8              :         tooltip-side="bottom"
       9              :         :class="actionClass(false)"
      10              :         type="button"
      11              :         :aria-label="compact ? t('load3d.menuBar.upDirection') : undefined"
      12              :       >
      13              :         <i class="icon-[lucide--move-3d]" />
      14              :         <span v-if="!compact">{{ t('load3d.menuBar.upDirection') }}</span>
      15              :       </Button>
      16              :     </PopoverTrigger>
      17              :     <PopoverContent align="start" :side-offset="8" :class="menuPanelClass">
      18            0 :       <button
      19              :         v-for="d in upDirections"
      20              :         :key="d"
      21              :         type="button"
      22              :         :class="
      23              :           cn(menuButtonClass, upDirection === d && selectedMenuButtonClass)
      24              :         "
      25              :         :aria-pressed="upDirection === d"
      26              :         @click="setUpDirection(d)"
      27              :       >
      28              :         {{ d.toUpperCase() }}
      29              :       </button>
      30              :     </PopoverContent>
      31              :   </PopoverRoot>
      32              : 
      33              :   <PopoverRoot v-if="materialModes.length" v-model:open="materialOpen">
      34              :     <PopoverTrigger as-child>
      35              :       <Button
      36              :         variant="textonly"
      37              :         size="unset"
      38              :         :tooltip="t('load3d.menuBar.material')"
      39              :         tooltip-side="bottom"
      40              :         :class="actionClass(false)"
      41              :         type="button"
      42              :         :aria-label="compact ? t('load3d.menuBar.material') : undefined"
      43              :       >
      44              :         <i class="icon-[lucide--box]" />
      45              :         <span v-if="!compact">{{ t('load3d.menuBar.material') }}</span>
      46              :       </Button>
      47              :     </PopoverTrigger>
      48              :     <PopoverContent align="start" :side-offset="8" :class="menuPanelClass">
      49            0 :       <button
      50              :         v-for="m in materialModes"
      51              :         :key="m"
      52              :         type="button"
      53              :         :class="
      54              :           cn(menuButtonClass, materialMode === m && selectedMenuButtonClass)
      55              :         "
      56              :         :aria-pressed="materialMode === m"
      57              :         @click="setMaterialMode(m)"
      58              :       >
      59              :         {{ t(`load3d.materialModes.${m}`) }}
      60              :       </button>
      61              :     </PopoverContent>
      62              :   </PopoverRoot>
      63              : 
      64              :   <Button
      65              :     v-if="hasSkeleton"
      66              :     variant="textonly"
      67              :     size="unset"
      68              :     :tooltip="t('load3d.menuBar.skeleton')"
      69              :     tooltip-side="bottom"
      70              :     :class="actionClass(showSkeleton)"
      71              :     :aria-pressed="showSkeleton"
      72              :     type="button"
      73              :     :aria-label="compact ? t('load3d.menuBar.skeleton') : undefined"
      74              :     @click="toggleSkeleton"
      75              :   >
      76              :     <i class="icon-[lucide--bone]" />
      77              :     <span v-if="!compact">{{ t('load3d.menuBar.skeleton') }}</span>
      78              :   </Button>
      79              : </template>
      80              : 
      81              : <script setup lang="ts">
      82              : import { PopoverRoot, PopoverTrigger } from 'reka-ui'
      83              : import { computed } from 'vue'
      84              : import { useI18n } from 'vue-i18n'
      85              : 
      86              : import { cn } from '@comfyorg/tailwind-utils'
      87              : 
      88              : import {
      89              :   actionClass,
      90              :   menuPanelClass
      91              : } from '@/extensions/core/load3d/components/menubar/menuBarStyles'
      92              : import { usePopoverExclusivity } from '@/extensions/core/load3d/components/menubar/usePopoverExclusivity'
      93              : import Button from '@comfyorg/design-system/button/Button'
      94              : import PopoverContent from '@comfyorg/design-system/popover/PopoverContent'
      95              : import {
      96              :   menuButtonClass,
      97              :   selectedMenuButtonClass
      98              : } from '@comfyorg/design-system/lib/menu/menuStyles'
      99              : import type {
     100              :   MaterialMode,
     101              :   ModelConfig,
     102              :   UpDirection
     103              : } from '@comfyorg/viewport3d/load3d/interfaces'
     104              : 
     105              : const {
     106              :   compact = false,
     107              :   hasSkeleton = false,
     108              :   materialModes = ['original', 'clay', 'normal', 'wireframe']
     109              : } = defineProps<{
     110              :   compact?: boolean
     111              :   hasSkeleton?: boolean
     112              :   materialModes?: readonly MaterialMode[]
     113              : }>()
     114              : 
     115            0 : const config = defineModel<ModelConfig>('config')
     116              : 
     117            0 : const { t } = useI18n()
     118              : 
     119            0 : const upDirection = computed(() => config.value?.upDirection)
     120            0 : const materialMode = computed(() => config.value?.materialMode)
     121            0 : const showSkeleton = computed(() => config.value?.showSkeleton ?? false)
     122              : 
     123            0 : const exclusivePopover = usePopoverExclusivity()
     124            0 : const upDirectionOpen = exclusivePopover('model-up-direction')
     125            0 : const materialOpen = exclusivePopover('model-material')
     126              : 
     127            0 : const upDirections: UpDirection[] = [
     128              :   'original',
     129              :   '-x',
     130              :   '+x',
     131              :   '-y',
     132              :   '+y',
     133              :   '-z',
     134              :   '+z'
     135              : ]
     136              : 
     137            0 : function setUpDirection(direction: UpDirection) {
     138            0 :   if (config.value) config.value.upDirection = direction
     139              : }
     140              : 
     141            0 : function setMaterialMode(mode: MaterialMode) {
     142            0 :   if (config.value) config.value.materialMode = mode
     143              : }
     144              : 
     145            0 : function toggleSkeleton() {
     146            0 :   if (config.value) config.value.showSkeleton = !config.value.showSkeleton
     147              : }
     148              : </script>
        

Generated by: LCOV version 2.0-1