handleDoubleTap method

void handleDoubleTap(
  1. TapPosition tapPosition, {
  2. dynamic returnPositionTapped(
    1. LatLng?,
    2. double? zoom
    )?,
  3. bool absorbPointer = false,
})

Implementation

void handleDoubleTap(TapPosition tapPosition,
    {Function(LatLng?, double? zoom)? returnPositionTapped,
    bool absorbPointer = false}) {
  final centerPos = _pointToOffset(map!.size!) / 2.0;
  final newZoom = _getZoomForScale(map!.zoom, 2.0);
  final focalDelta = _getDoubleTapFocalDelta(
      centerPos, tapPosition.relative!, newZoom - map!.zoom);
  final newCenter = _offsetToCrs(centerPos + focalDelta);
  if (returnPositionTapped != null) {
    returnPositionTapped(newCenter, newZoom);
  }

  if (!absorbPointer) {
    _resetDoubleTapHold();

    // final centerPos = _pointToOffset(map!.size!) / 2.0;
    // final newZoom = _getZoomForScale(map!.zoom, 2.0);
    if (newZoom >= 19) {
      return;
    } // so that it doesnt black out if user keeps on zooming
    // final focalDelta = _getDoubleTapFocalDelta(
    //     centerPos, tapPosition.relative!, newZoom - map!.zoom);
    // final newCenter = _offsetToCrs(centerPos + focalDelta);
    _startDoubleTapAnimation(newZoom, newCenter);
  }
}