@@ -8,8 +8,6 @@ import { Mesh } from '../../objects/Mesh';
8
8
import { LineBasicMaterial } from '../../materials/LineBasicMaterial' ;
9
9
import { Line } from '../../objects/Line' ;
10
10
11
- var ArrowHelper ;
12
-
13
11
/**
14
12
* @author WestLangley / http://github.com/WestLangley
15
13
* @author zz85 / http://github.com/zz85
@@ -26,41 +24,37 @@ var ArrowHelper;
26
24
* headWidth - Number
27
25
*/
28
26
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 ) ) ;
33
29
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 ) ;
36
32
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 ) {
40
34
41
- Object3D . call ( this ) ;
35
+ // dir is assumed to be normalized
42
36
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 ) ;
47
38
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 ;
49
43
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 ) ;
53
45
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 ) ;
57
49
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 ) ;
60
53
61
- } ;
54
+ this . setDirection ( dir ) ;
55
+ this . setLength ( length , headLength , headWidth ) ;
62
56
63
- } ( ) ) ;
57
+ }
64
58
65
59
ArrowHelper . prototype = Object . create ( Object3D . prototype ) ;
66
60
ArrowHelper . prototype . constructor = ArrowHelper ;
@@ -118,4 +112,4 @@ ArrowHelper.prototype.setColor = function ( color ) {
118
112
} ;
119
113
120
114
121
- export { ArrowHelper } ;
115
+ export { ArrowHelper } ;
0 commit comments