[3d] support using image as background (#2657)

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Terry Jia
2025-02-20 20:05:54 -05:00
committed by GitHub
parent 02d77002c9
commit c3c6ec627b
15 changed files with 475 additions and 72 deletions

View File

@@ -19,6 +19,7 @@ const props = defineProps<{
fov: number
cameraType: 'perspective' | 'orthographic'
showPreview: boolean
backgroundImage: string
extraListeners?: Record<string, (value: any) => void>
}>()
@@ -34,7 +35,8 @@ const eventConfig = {
fovChange: (value: number) => emit('fovChange', value),
cameraTypeChange: (value: string) => emit('cameraTypeChange', value),
showGridChange: (value: boolean) => emit('showGridChange', value),
showPreviewChange: (value: boolean) => emit('showPreviewChange', value)
showPreviewChange: (value: boolean) => emit('showPreviewChange', value),
backgroundImageChange: (value: string) => emit('backgroundImageChange', value)
} as const
watchEffect(() => {
@@ -47,6 +49,7 @@ watchEffect(() => {
rawLoad3d.setFOV(props.fov)
rawLoad3d.toggleCamera(props.cameraType)
rawLoad3d.togglePreview(props.showPreview)
rawLoad3d.setBackgroundImage(props.backgroundImage)
}
})
@@ -58,6 +61,7 @@ const emit = defineEmits<{
(e: 'cameraTypeChange', cameraType: string): void
(e: 'showGridChange', showGrid: boolean): void
(e: 'showPreviewChange', showPreview: boolean): void
(e: 'backgroundImageChange', backgroundImage: string): void
}>()
const handleEvents = (action: 'add' | 'remove') => {