Files
ComfyUI_frontend/src/components/load3d/controls/viewer/ViewerSceneControls.vue
Kelly Yang 4f3a5ae184 fix(load3d): fix squashed controls in 3D inspector side panel (#10768)
## Summary

Fixes squashed `input controls` (color picker, sliders, dropdowns) in
the 3D asset inspector side panel.

## Screenshots 

before
<img width="3012" height="1580" alt="image"
src="https://github.com/user-attachments/assets/edc6fadc-cdc5-4a4e-92e7-57faabfeb1a4"
/>

after
<img width="4172" height="2062" alt="image"
src="https://github.com/user-attachments/assets/766324ce-e8f7-43fc-899e-ae275f880e59"
/>

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-10768-fix-load3d-fix-squashed-controls-in-3D-inspector-side-panel-3346d73d365081e8b438de8115180685)
by [Unito](https://www.unito.io)
2026-04-01 00:34:37 -04:00

104 lines
2.8 KiB
Vue

<template>
<div class="space-y-4">
<div v-if="!hasBackgroundImage" class="flex flex-col gap-2">
<label>
{{ $t('load3d.backgroundColor') }}
</label>
<input v-model="backgroundColor" type="color" class="h-8 w-full" />
</div>
<div>
<Checkbox v-model="showGrid" input-id="showGrid" binary name="showGrid" />
<label for="showGrid" class="pl-2">
{{ $t('load3d.showGrid') }}
</label>
</div>
<div v-if="!hasBackgroundImage && !disableBackgroundUpload">
<Button variant="secondary" class="w-full" @click="openImagePicker">
<i class="pi pi-image" />
{{ $t('load3d.uploadBackgroundImage') }}
</Button>
<input
ref="imagePickerRef"
type="file"
accept="image/*"
class="hidden"
@change="handleImageUpload"
/>
</div>
<div v-if="hasBackgroundImage" class="space-y-2">
<div class="flex gap-2">
<Button
:variant="backgroundRenderMode === 'tiled' ? 'primary' : 'secondary'"
class="flex-1"
@click="setBackgroundRenderMode('tiled')"
>
<i class="pi pi-th-large" />
{{ $t('load3d.tiledMode') }}
</Button>
<Button
:variant="
backgroundRenderMode === 'panorama' ? 'primary' : 'secondary'
"
class="flex-1"
@click="setBackgroundRenderMode('panorama')"
>
<i class="pi pi-globe" />
{{ $t('load3d.panoramaMode') }}
</Button>
</div>
<Button variant="secondary" class="w-full" @click="removeBackgroundImage">
<i class="pi pi-times" />
{{ $t('load3d.removeBackgroundImage') }}
</Button>
</div>
</div>
</template>
<script setup lang="ts">
import Checkbox from 'primevue/checkbox'
import { ref } from 'vue'
import Button from '@/components/ui/button/Button.vue'
const backgroundColor = defineModel<string>('backgroundColor')
const showGrid = defineModel<boolean>('showGrid')
const backgroundRenderMode = defineModel<'tiled' | 'panorama'>(
'backgroundRenderMode'
)
defineProps<{
hasBackgroundImage?: boolean
disableBackgroundUpload?: boolean
}>()
const emit = defineEmits<{
(e: 'updateBackgroundImage', file: File | null): void
}>()
const imagePickerRef = ref<HTMLInputElement | null>(null)
const openImagePicker = () => {
imagePickerRef.value?.click()
}
const handleImageUpload = (event: Event) => {
const input = event.target as HTMLInputElement
if (input.files && input.files[0]) {
emit('updateBackgroundImage', input.files[0])
}
input.value = ''
}
const removeBackgroundImage = () => {
emit('updateBackgroundImage', null)
}
const setBackgroundRenderMode = (mode: 'tiled' | 'panorama') => {
backgroundRenderMode.value = mode
}
</script>