onPinchMove method

dynamic onPinchMove()

Implementation

onPinchMove() {
  if (this.enabled && this.enableZoom) {
    this.setCenter(
        (this._touchCurrent[0].clientX + this._touchCurrent[1].clientX) / 2,
        (this._touchCurrent[0].clientY + this._touchCurrent[1].clientY) / 2);
    var minDistance = 12; //minimum distance between fingers (in css pixels)

    if (this._state != STATE2.SCALE) {
      this._startFingerDistance = this._currentFingerDistance;
      this.updateTbState(STATE2.SCALE, true);
    }

    this._currentFingerDistance = Math.max(
        this.calculatePointersDistance(
            this._touchCurrent[0], this._touchCurrent[1]),
        minDistance * this._devPxRatio);
    var amount = this._currentFingerDistance / this._startFingerDistance;

    var scalePoint;

    if (!this.enablePan) {
      scalePoint = this._gizmos.position;
    } else {
      if (this.camera is OrthographicCamera) {
        scalePoint = this
            .unprojectOnTbPlane(
                this.camera, _center.x, _center.y, this.domElement)
            .applyQuaternion(this.camera.quaternion)
            .multiplyScalar(1 / this.camera.zoom)
            .add(this._gizmos.position);
      } else if (this.camera is PerspectiveCamera) {
        scalePoint = this
            .unprojectOnTbPlane(
                this.camera, _center.x, _center.y, this.domElement)
            .applyQuaternion(this.camera.quaternion)
            .add(this._gizmos.position);
      }
    }

    this.applyTransformMatrix(this.scale(amount, scalePoint));
    this.dispatchEvent(_changeEvent);
  }
}