Prechádzať zdrojové kódy

UI: Fixed console error.

Mr.doob 9 rokov pred
rodič
commit
5daf11e405
1 zmenil súbory, kde vykonal 8 pridanie a 1 odobranie
  1. 8 1
      editor/js/libs/ui.three.js

+ 8 - 1
editor/js/libs/ui.three.js

@@ -118,7 +118,14 @@ UI.Texture.prototype.setValue = function ( texture ) {
 	} else {
 	} else {
 
 
 		name.value = '';
 		name.value = '';
-		context.clearRect( 0, 0, canvas.width, canvas.height );
+
+		if ( context !== null ) {
+
+			// Seems like context can be null if the canvas is not visible
+
+			context.clearRect( 0, 0, canvas.width, canvas.height );
+
+		}
 
 
 	}
 	}