move method

bool move(
  1. LatLng center,
  2. double zoom, {
  3. dynamic hasGesture = false,
  4. dynamic callOnMoveSink = true,
  5. required MapEventSource source,
  6. String? id,
})

Implementation

bool move(LatLng center, double zoom,
    {hasGesture = false,
    callOnMoveSink = true,
    required MapEventSource source,
    String? id}) {
  zoom = fitZoomToBounds(zoom);
  final mapMoved = center != _lastCenter || zoom != _zoom;

  if (_lastCenter != null && (!mapMoved || !bounds.isValid)) {
    return false;
  }

  if (options.isOutOfBounds(center)) {
    if (!options.slideOnBoundaries) {
      return false;
    }
    center = options.containPoint(center, _lastCenter ?? center);
  }

  _handleMoveEmit(center, zoom, hasGesture, source, id);

  _zoom = zoom;
  _lastCenter = center;
  _lastPixelBounds = getPixelBounds(_zoom);
  _lastBounds = _calculateBounds();
  _pixelOrigin = getNewPixelOrigin(center);
  if (callOnMoveSink) {
    _onMoveSink.add(null);
  }

  if (options.onPositionChanged != null) {
    var mapPosition = MapPosition(
        center: center, bounds: bounds, zoom: zoom, hasGesture: hasGesture);

    options.onPositionChanged!(mapPosition, hasGesture);
  }

  return true;
}