Explorar el Código

Fix error caused by undefined self when using three on the node.js command line (e.g. in tests)

Arthur Silber hace 10 años
padre
commit
88fc758860
Se han modificado 1 ficheros con 7 adiciones y 2 borrados
  1. 7 2
      src/extras/FontUtils.js

+ 7 - 2
src/extras/FontUtils.js

@@ -464,5 +464,10 @@ THREE.FontUtils.generateShapes = function ( text, parameters ) {
 } )( THREE.FontUtils );
 
 // To use the typeface.js face files, hook up the API
-self._typeface_js = { faces: THREE.FontUtils.faces, loadFace: THREE.FontUtils.loadFace };
-THREE.typeface_js = self._typeface_js;
+var typeface_js = { faces: THREE.FontUtils.faces, loadFace: THREE.FontUtils.loadFace };
+if ( typeof self != 'undefined' ){
+	self._typeface_js = typeface_js
+}
+THREE.typeface_js = typeface_js
+
+