onSinglePanEnd method

dynamic onSinglePanEnd()

Implementation

onSinglePanEnd() {
  if (this._state == STATE2.ROTATE) {
    if (!this.enableRotate) {
      return;
    }

    if (this.enableAnimations) {
      //perform rotation animation
      var deltaTime =
          (DateTime.now().millisecondsSinceEpoch - this._timeCurrent);
      if (deltaTime < 120) {
        var w = Math.abs((this._wPrev + this._wCurr) / 2);

        var self = this;
        this._animationId = requestAnimationFrame((t) {
          self.updateTbState(STATE2.ANIMATION_ROTATE, true);
          var rotationAxis = self.calculateRotationAxis(
              self._cursorPosPrev, self._cursorPosCurr);

          self.onRotationAnim(t, rotationAxis, Math.min(w, self.wMax));
        });
      } else {
        //cursor has been standing still for over 120 ms since last movement
        this.updateTbState(STATE2.IDLE, false);
        this.activateGizmos(false);
        this.dispatchEvent(_changeEvent);
      }
    } else {
      this.updateTbState(STATE2.IDLE, false);
      this.activateGizmos(false);
      this.dispatchEvent(_changeEvent);
    }
  } else if (this._state == STATE2.PAN || this._state == STATE2.IDLE) {
    this.updateTbState(STATE2.IDLE, false);

    if (this.enableGrid) {
      this.disposeGrid();
    }

    this.activateGizmos(false);
    this.dispatchEvent(_changeEvent);
  }

  this.dispatchEvent(_endEvent);
}