Kaynağa Gözat

Update Audio.js

Clean up.
Michael Herzog 1 yıl önce
ebeveyn
işleme
4d476ff238
1 değiştirilmiş dosya ile 9 ekleme ve 10 silme
  1. 9 10
      src/audio/Audio.js

+ 9 - 10
src/audio/Audio.js

@@ -400,6 +400,14 @@ class Audio extends Object3D {
 
 		super.copy( source, recursive );
 
+		if ( source.sourceType !== 'buffer' ) {
+
+			console.warn( 'THREE.Audio: Audio source type cannot be copied.' );
+
+			return this;
+
+		}
+
 		this.autoplay = source.autoplay;
 
 		this.buffer = source.buffer;
@@ -411,19 +419,10 @@ class Audio extends Object3D {
 		this.duration = source.duration;
 		this.playbackRate = source.playbackRate;
 		this.hasPlaybackControl = source.hasPlaybackControl;
+		this.sourceType = source.sourceType;
 
 		this.filters = source.filters.slice();
 
-		if ( source.sourceType !== 'buffer' ) {
-
-			console.warn( 'THREE.Audio: Audio source type cannot be copied.' );
-
-			return this;
-
-		}
-
-		this.sourceType = source.sourceType;
-
 		return this;
 
 	}

粤ICP备19079148号