processTap method

void processTap()

Handles user interaction with the location button.

Cycles through different tracking modes based on current state:

  • Switches between full tracking and north-aligned tracking
  • Handles hideable state
  • Updates button icon based on current mode

Implementation

void processTap() {
  if ((!_isHideable &&
          _currentBehaviour == _Behaviour.withoutBearing.value) ||
      !_isFollowPositionMode) {
    _model.value = _model.value.copyWith(
      behaviour: _Behaviour.full.value,
      iconAssetName:
          'packages/$pluginName/assets/icons/dgis_follow_direction.svg',
    );
    map.camera.setBehaviour(_Behaviour.full.value);
    return;
  } else if (!_isHideable) {
    _model.value = _model.value.copyWith(
      behaviour: _Behaviour.withoutBearing.value,
      iconAssetName: 'packages/$pluginName/assets/icons/dgis_my_location.svg',
    );
    map.camera.setBehaviour(_Behaviour.withoutBearing.value);
    map.processEvent(sdk.RotateMapToNorthEvent());
    return;
  }
  _model.value = _model.value.copyWith(
    behaviour: _Behaviour.full.value,
    iconAssetName:
        'packages/$pluginName/assets/icons/dgis_follow_direction.svg',
  );
  map.camera.setBehaviour(_Behaviour.full.value);
}