Skip to content

Commit 072a035

Browse files
committed
ArrowHelper: Removed no longer needed closure.
1 parent 11aac1d commit 072a035

File tree

1 file changed

+22
-28
lines changed

1 file changed

+22
-28
lines changed

src/extras/helpers/ArrowHelper.js

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import { Mesh } from '../../objects/Mesh';
88
import { LineBasicMaterial } from '../../materials/LineBasicMaterial';
99
import { Line } from '../../objects/Line';
1010

11-
var ArrowHelper;
12-
1311
/**
1412
* @author WestLangley / http://github.com/WestLangley
1513
* @author zz85 / http://github.com/zz85
@@ -26,41 +24,37 @@ var ArrowHelper;
2624
* headWidth - Number
2725
*/
2826

29-
ArrowHelper = ( function () {
30-
31-
var lineGeometry = new BufferGeometry();
32-
lineGeometry.addAttribute( 'position', new Float32Attribute( [ 0, 0, 0, 0, 1, 0 ], 3 ) );
27+
var lineGeometry = new BufferGeometry();
28+
lineGeometry.addAttribute( 'position', new Float32Attribute( [ 0, 0, 0, 0, 1, 0 ], 3 ) );
3329

34-
var coneGeometry = new CylinderBufferGeometry( 0, 0.5, 1, 5, 1 );
35-
coneGeometry.translate( 0, - 0.5, 0 );
30+
var coneGeometry = new CylinderBufferGeometry( 0, 0.5, 1, 5, 1 );
31+
coneGeometry.translate( 0, - 0.5, 0 );
3632

37-
return function ArrowHelper( dir, origin, length, color, headLength, headWidth ) {
38-
39-
// dir is assumed to be normalized
33+
function ArrowHelper( dir, origin, length, color, headLength, headWidth ) {
4034

41-
Object3D.call( this );
35+
// dir is assumed to be normalized
4236

43-
if ( color === undefined ) color = 0xffff00;
44-
if ( length === undefined ) length = 1;
45-
if ( headLength === undefined ) headLength = 0.2 * length;
46-
if ( headWidth === undefined ) headWidth = 0.2 * headLength;
37+
Object3D.call( this );
4738

48-
this.position.copy( origin );
39+
if ( color === undefined ) color = 0xffff00;
40+
if ( length === undefined ) length = 1;
41+
if ( headLength === undefined ) headLength = 0.2 * length;
42+
if ( headWidth === undefined ) headWidth = 0.2 * headLength;
4943

50-
this.line = new Line( lineGeometry, new LineBasicMaterial( { color: color } ) );
51-
this.line.matrixAutoUpdate = false;
52-
this.add( this.line );
44+
this.position.copy( origin );
5345

54-
this.cone = new Mesh( coneGeometry, new MeshBasicMaterial( { color: color } ) );
55-
this.cone.matrixAutoUpdate = false;
56-
this.add( this.cone );
46+
this.line = new Line( lineGeometry, new LineBasicMaterial( { color: color } ) );
47+
this.line.matrixAutoUpdate = false;
48+
this.add( this.line );
5749

58-
this.setDirection( dir );
59-
this.setLength( length, headLength, headWidth );
50+
this.cone = new Mesh( coneGeometry, new MeshBasicMaterial( { color: color } ) );
51+
this.cone.matrixAutoUpdate = false;
52+
this.add( this.cone );
6053

61-
};
54+
this.setDirection( dir );
55+
this.setLength( length, headLength, headWidth );
6256

63-
}() );
57+
}
6458

6559
ArrowHelper.prototype = Object.create( Object3D.prototype );
6660
ArrowHelper.prototype.constructor = ArrowHelper;
@@ -118,4 +112,4 @@ ArrowHelper.prototype.setColor = function ( color ) {
118112
};
119113

120114

121-
export { ArrowHelper };
115+
export { ArrowHelper };

0 commit comments

Comments
 (0)