소스 검색

fix: element size

enpitsulin 2 년 전
부모
커밋
af4360a3cc
1개의 변경된 파일1개의 추가작업 그리고 6개의 파일을 삭제
  1. 1 6
      src/composables/useTresContextProvider/index.ts

+ 1 - 6
src/composables/useTresContextProvider/index.ts

@@ -36,12 +36,7 @@ export function useTresContextProvider({
   rendererOptions: UseRendererOptions
 }): TresContext {
 
-  const elementSize = computed(() => {
-    if (toValue(windowSize))
-      return useWindowSize()
-    return useElementSize(toValue(canvas)!.parentElement)
-  }
-  )
+  const elementSize = computed(() => toValue(windowSize) ? useWindowSize() : useElementSize(toValue(canvas)?.parentElement))
 
   const width = computed(() => elementSize.value.width.value)
   const height = computed(() => elementSize.value.height.value)