Skip to content

Commit 3447ee8

Browse files
authored
Merge pull request #15057 from WestLangley/dev-arrow_helper_clone
ArrowHelper: support cloning
2 parents 5fa442d + 7648f2b commit 3447ee8

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/helpers/ArrowHelper.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ function ArrowHelper( dir, origin, length, color, headLength, headWidth ) {
3232

3333
Object3D.call( this );
3434

35-
if ( color === undefined ) color = 0xffff00;
35+
if ( dir === undefined ) dir = new THREE.Vector3( 0, 0, 1 );
36+
if ( origin === undefined ) origin = new THREE.Vector3( 0, 0, 0 );
3637
if ( length === undefined ) length = 1;
38+
if ( color === undefined ) color = 0xffff00;
3739
if ( headLength === undefined ) headLength = 0.2 * length;
3840
if ( headWidth === undefined ) headWidth = 0.2 * headLength;
3941

@@ -117,5 +119,21 @@ ArrowHelper.prototype.setColor = function ( color ) {
117119

118120
};
119121

122+
ArrowHelper.prototype.copy = function ( source ) {
123+
124+
Object3D.prototype.copy.call( this, source, false );
125+
126+
this.line.copy( source.line );
127+
this.cone.copy( source.cone );
128+
129+
return this;
130+
131+
};
132+
133+
ArrowHelper.prototype.clone = function () {
134+
135+
return new this.constructor().copy( this );
136+
137+
};
120138

121139
export { ArrowHelper };

0 commit comments

Comments
 (0)