Răsfoiți Sursa

Merge pull request #15062 from WestLangley/dev-line_clone_copy

Line: fix copy and clone methods
Mr.doob 6 ani în urmă
părinte
comite
bc844a70f3
1 a modificat fișierele cu 12 adăugiri și 1 ștergeri
  1. 12 1
      src/objects/Line.js

+ 12 - 1
src/objects/Line.js

@@ -244,9 +244,20 @@ Line.prototype = Object.assign( Object.create( Object3D.prototype ), {
 
 	}() ),
 
+	copy: function ( source ) {
+
+		Object3D.prototype.copy.call( this, source );
+
+		this.geometry.copy( source.geometry );
+		this.material.copy( source.material );
+
+		return this;
+
+	},
+
 	clone: function () {
 
-		return new this.constructor( this.geometry, this.material ).copy( this );
+		return new this.constructor().copy( this );
 
 	}