MCPcopy
hub / github.com/mrdoob/three.js / constructor

Method constructor

editor/js/EditorControls.js:5–471  ·  view source on GitHub ↗
( object )

Source from the content-addressed store, hash-verified

3class EditorControls extends THREE.EventDispatcher {
4
5 constructor( object ) {
6
7 super();
8
9 // API
10
11 this.enabled = true;
12 this.center = new THREE.Vector3();
13 this.panSpeed = 0.002;
14 this.zoomSpeed = 0.1;
15 this.rotationSpeed = 0.005;
16
17 // internals
18
19 var scope = this;
20 var vector = new THREE.Vector3();
21 var delta = new THREE.Vector3();
22 var box = new THREE.Box3();
23
24 var STATE = { NONE: - 1, ROTATE: 0, ZOOM: 1, PAN: 2 };
25 var state = STATE.NONE;
26
27 var center = this.center;
28 var normalMatrix = new THREE.Matrix3();
29 var pointer = new THREE.Vector2();
30 var pointerOld = new THREE.Vector2();
31 var spherical = new THREE.Spherical();
32 var sphere = new THREE.Sphere();
33
34 var pointers = [];
35 var pointerPositions = {};
36
37 var domElement = null;
38
39 // events
40
41 var changeEvent = { type: 'change' };
42
43 this.setCamera = function ( camera ) {
44
45 object = camera;
46
47 };
48
49 this.focus = function ( target ) {
50
51 var distance;
52
53 box.setFromObject( target );
54
55 if ( box.isEmpty() === false ) {
56
57 box.getCenter( center );
58 distance = box.getBoundingSphere( sphere ).radius;
59
60 } else {
61
62 // Focusing on an Group, AmbientLight, etc

Callers

nothing calls this directly

Calls 15

setFromObjectMethod · 0.95
isEmptyMethod · 0.95
getCenterMethod · 0.95
getBoundingSphereMethod · 0.95
setMethod · 0.95
applyQuaternionMethod · 0.95
multiplyScalarMethod · 0.95
applyMatrix3Method · 0.95
getNormalMatrixMethod · 0.95
lengthMethod · 0.95
copyMethod · 0.95
setFromVector3Method · 0.95

Tested by

no test coverage detected