onMouseDown method

dynamic onMouseDown(
  1. dynamic event
)

Implementation

onMouseDown(event) {
  if (_state == State.none) {
    if (event.button == scope.mouseButtons['LEFT']) {
      _state = State.rotate;
    } else if (event.button == scope.mouseButtons['MIDDLE']) {
      _state = State.zoom;
    } else if (event.button == scope.mouseButtons['RIGHT']) {
      _state = State.pan;
    }
  }

  var state = (_keyState != State.none) ? _keyState : _state;

  if (state == State.rotate && !scope.noRotate) {
    _moveCurr.copy(getMouseOnCircle(event.pageX, event.pageY));
    _movePrev.copy(_moveCurr);
  } else if (state == State.zoom && !scope.noZoom) {
    _zoomStart.copy(getMouseOnScreen(event.pageX, event.pageY));
    _zoomEnd.copy(_zoomStart);
  } else if (state == State.pan && !scope.noPan) {
    _panStart.copy(getMouseOnScreen(event.pageX, event.pageY));
    _panEnd.copy(_panStart);
  }

  scope.dispatchEvent(_startEvent);
}