Răsfoiți Sursa

fix: element size

enpitsulin 2 ani în urmă
părinte
comite
af4360a3cc
1 a modificat fișierele cu 1 adăugiri și 6 ștergeri
  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)