Browse Source

Editor: Fixed duplicate loading.

Mr.doob 9 years ago
parent
commit
c5b8b49d29
1 changed files with 6 additions and 3 deletions
  1. 6 3
      editor/index.html

+ 6 - 3
editor/index.html

@@ -207,6 +207,8 @@
 
 				editor.storage.get( function ( state ) {
 
+					if ( isLoadingFromHash ) return;
+
 					if ( state !== undefined ) {
 
 						editor.fromJSON( state );
@@ -338,6 +340,7 @@
 
 			//
 
+			var isLoadingFromHash = false;
 			var hash = window.location.hash;
 
 			if ( hash.substr( 1, 5 ) === 'file=' ) {
@@ -350,13 +353,13 @@
 					loader.crossOrigin = '';
 					loader.load( file, function ( text ) {
 
-						var json = JSON.parse( text );
-
 						editor.clear();
-						editor.fromJSON( json );
+						editor.fromJSON( JSON.parse( text ) );
 
 					} );
 
+					isLoadingFromHash = true;
+
 				}
 
 			}