onPointerDown method

dynamic onPointerDown(
  1. dynamic event
)

Implementation

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

  if (event.pointerType == 'touch' && _input != Input.cursor) {
    _touchStart.add(event);
    _touchCurrent.add(event);

    switch (_input) {
      case Input.none:

        //singleStart
        _input = Input.oneFinger;
        onSinglePanStart(event, 'ROTATE');

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

        break;

      case Input.oneFinger:
      case Input.oneFingerSwitched:

        //doubleStart
        _input = Input.twoFinger;

        onRotateStart();
        onPinchStart();
        onDoublePanStart();

        break;

      case Input.twoFinger:

        //multipleStart
        _input = Input.multiFinger;
        onTriplePanStart(event);
        break;
    }
  } else if (event.pointerType != 'touch' && _input == Input.none) {
    String? modifier;
    if (event.ctrlKey || event.metaKey) {
      modifier = 'CTRL';
    } else if (event.shiftKey) {
      modifier = 'SHIFT';
    }

    _mouseOp = getOpFromAction(event.button, modifier);

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

      //singleStart
      _input = Input.cursor;
      _button = event.button;
      onSinglePanStart(event, _mouseOp);
    }
  }
}