Răsfoiți Sursa

Merge pull request #291 from Tresjs/fix/263-message-canvas-height

fix: message canvas 0 height false positives
Alvaro Saburido 1 an în urmă
părinte
comite
1de79a65f5
1 a modificat fișierele cu 6 adăugiri și 4 ștergeri
  1. 6 4
      src/composables/useRenderer/index.ts

+ 6 - 4
src/composables/useRenderer/index.ts

@@ -158,10 +158,12 @@ export function useRenderer(options: UseRendererOptions) {
   const { pause, resume } = useRenderLoop()
   const aspectRatio = computed(() => width.value / height.value)
 
-  if (!toValue(windowSize) && state.container?.value?.offsetHeight === 0) {
-    logWarning(`Oops... Seems like your canvas height is currently 0px, by default it takes the height of it's parent, so make sure it has some height with CSS.
-You could set windowSize=true to force the canvas to be the size of the window.`)
-  }
+  setTimeout(() => {
+    if (!toValue(windowSize) && !state.canvas.value.offsetHeight) {
+      logWarning(`Oops... Seems like your canvas height is currently 0px, it's posible that you couldn't watch your scene.
+  You could set windowSize=true to force the canvas to be the size of the window.`)
+    }
+  }, 1000)
 
   const updateRendererSize = () => {
     if (!renderer.value) {