|
@@ -58,6 +58,12 @@ THREE.TrackballControls = function ( object, domElement ) {
|
|
|
_panStart = new THREE.Vector2(),
|
|
|
_panEnd = new THREE.Vector2();
|
|
|
|
|
|
+ // for reset
|
|
|
+
|
|
|
+ this.target0 = this.target.clone();
|
|
|
+ this.position0 = this.object.position.clone();
|
|
|
+ this.up0 = this.object.up.clone();
|
|
|
+
|
|
|
// events
|
|
|
|
|
|
var changeEvent = { type: 'change' };
|
|
@@ -277,6 +283,25 @@ THREE.TrackballControls = function ( object, domElement ) {
|
|
|
|
|
|
};
|
|
|
|
|
|
+ this.reset = function () {
|
|
|
+
|
|
|
+ _state = STATE.NONE;
|
|
|
+ _prevState = STATE.NONE;
|
|
|
+
|
|
|
+ _this.target.copy( _this.target0 );
|
|
|
+ _this.object.position.copy( _this.position0 );
|
|
|
+ _this.object.up.copy( _this.up0 );
|
|
|
+
|
|
|
+ _eye.subVectors( _this.object.position, _this.target );
|
|
|
+
|
|
|
+ _this.object.lookAt( _this.target );
|
|
|
+
|
|
|
+ //_this.dispatchEvent( changeEvent ); // not sure what this is for
|
|
|
+
|
|
|
+ lastPosition.copy( _this.object.position );
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
// listeners
|
|
|
|
|
|
function keydown( event ) {
|