in src/state/state/InteractiveStateBase.ts [433:494]
protected _updateRotationBasic(): void {
if (this._requestedBasicRotation != null) {
let x: number = this._basicRotation[0];
let y: number = this._basicRotation[1];
let reqX: number = this._requestedBasicRotation[0];
let reqY: number = this._requestedBasicRotation[1];
if (Math.abs(reqX) > Math.abs(x)) {
this._basicRotation[0] = (1 - this._rotationIncreaseAlpha) * x + this._rotationIncreaseAlpha * reqX;
} else {
this._basicRotation[0] = (1 - this._rotationDecreaseAlpha) * x + this._rotationDecreaseAlpha * reqX;
}
if (Math.abs(reqY) > Math.abs(y)) {
this._basicRotation[1] = (1 - this._rotationIncreaseAlpha) * y + this._rotationIncreaseAlpha * reqY;
} else {
this._basicRotation[1] = (1 - this._rotationDecreaseAlpha) * y + this._rotationDecreaseAlpha * reqY;
}
this._requestedBasicRotation = null;
return;
}
if (this._requestedBasicRotationUnbounded != null) {
let reqX: number = this._requestedBasicRotationUnbounded[0];
let reqY: number = this._requestedBasicRotationUnbounded[1];
if (Math.abs(reqX) > 0) {
this._basicRotation[0] = (1 - this._unboundedRotationAlpha) * this._basicRotation[0] + this._unboundedRotationAlpha * reqX;
}
if (Math.abs(reqY) > 0) {
this._basicRotation[1] = (1 - this._unboundedRotationAlpha) * this._basicRotation[1] + this._unboundedRotationAlpha * reqY;
}
if (this._desiredLookat != null) {
let desiredBasicLookat: number[] = this.currentTransform.projectBasic(this._desiredLookat.toArray());
desiredBasicLookat[0] += reqX;
desiredBasicLookat[1] += reqY;
this._desiredLookat = new THREE.Vector3()
.fromArray(this.currentTransform.unprojectBasic(desiredBasicLookat, this._lookatDepth));
}
this._requestedBasicRotationUnbounded = null;
}
if (this._basicRotation[0] === 0 && this._basicRotation[1] === 0) {
return;
}
this._basicRotation[0] = this._rotationAcceleration * this._basicRotation[0];
this._basicRotation[1] = this._rotationAcceleration * this._basicRotation[1];
if (Math.abs(this._basicRotation[0]) < this._rotationThreshold / Math.pow(2, this._zoom) &&
Math.abs(this._basicRotation[1]) < this._rotationThreshold / Math.pow(2, this._zoom)) {
this._basicRotation = [0, 0];
}
}