瀏覽代碼

UI: Fixed console error.

Mr.doob 9 年之前
父節點
當前提交
5daf11e405
共有 1 個文件被更改,包括 8 次插入1 次删除
  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 {
 
 		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 );
+
+		}
 
 	}