onPointerDown method

dynamic onPointerDown(
  1. dynamic event
)

Implementation

onPointerDown(event) {
  if (event.button == 0 && event.isPrimary) {
    this._downValid = true;
    this._downEvents.add(event);
    this._downStart = DateTime.now().millisecondsSinceEpoch;
  } else {
    this._downValid = false;
  }

  if (event.pointerType == 'touch' && this._input != INPUT.CURSOR) {
    this._touchStart.add(event);
    this._touchCurrent.add(event);

    switch (this._input) {
      case INPUT.NONE:

        //singleStart
        this._input = INPUT.ONE_FINGER;
        this.onSinglePanStart(event, 'ROTATE');

        domElement.addEventListener('pointermove', this.onPointerMove);
        domElement.addEventListener('pointerup', this.onPointerUp);

        break;

      case INPUT.ONE_FINGER:
      case INPUT.ONE_FINGER_SWITCHED:

        //doubleStart
        this._input = INPUT.TWO_FINGER;

        this.onRotateStart();
        this.onPinchStart();
        this.onDoublePanStart();

        break;

      case INPUT.TWO_FINGER:

        //multipleStart
        this._input = INPUT.MULT_FINGER;
        this.onTriplePanStart(event);
        break;
    }
  } else if (event.pointerType != 'touch' && this._input == INPUT.NONE) {
    var modifier = null;

    if (event.ctrlKey || event.metaKey) {
      modifier = 'CTRL';
    } else if (event.shiftKey) {
      modifier = 'SHIFT';
    }

    this._mouseOp = this.getOpFromAction(event.button, modifier);

    if (this._mouseOp != null) {
      domElement.addEventListener('pointermove', this.onPointerMove);
      domElement.addEventListener('pointerup', this.onPointerUp);

      //singleStart
      this._input = INPUT.CURSOR;
      this._button = event.button;
      this.onSinglePanStart(event, this._mouseOp);
    }
  }
}