Browse Source

fix https://forum.babylonjs.com/t/unexpected-mutation-with-engine-registerview/9169

David Catuhe 5 years ago
parent
commit
baedd30f2b
1 changed files with 6 additions and 4 deletions
  1. 6 4
      src/Engines/Extensions/engine.views.ts

+ 6 - 4
src/Engines/Extensions/engine.views.ts

@@ -134,10 +134,12 @@ Engine.prototype._renderViews = function() {
         }
 
         // Set sizes
-        canvas.width = canvas.clientWidth;
-        canvas.height = canvas.clientHeight;
-        parent.width = canvas.clientWidth;
-        parent.height = canvas.clientHeight;
+        if (canvas.clientWidth && canvas.clientHeight) {
+            canvas.width = canvas.clientWidth;
+            canvas.height = canvas.clientHeight;
+            parent.width = canvas.clientWidth;
+            parent.height = canvas.clientHeight;
+        }
 
         // Render the frame
         this._renderFrame();