askChangeZoomlevel method

  1. @override
  2. @mustCallSuper
void askChangeZoomlevel(
  1. int zoomlevel,
  2. BoundingBox boundingBox,
  3. PixelProjection projection
)
override

Called when the map zoom level changes.

This method provides an opportunity to:

  • Load markers appropriate for the new zoom level
  • Apply zoom-based filtering or clustering
  • Update marker styles or visibility
  • Initialize data structures for the new view

The method is called before askChangeBoundingBox when both zoom level and position change simultaneously.

zoomlevel The new zoom level (typically 0-20) boundingBox The visible geographic area at the new zoom level projection The pixel projection for coordinate transformations

Implementation Notes:

  • This is the primary method for zoom-aware marker management
  • Consider marker clustering at lower zoom levels
  • Filter out inappropriate markers for the zoom level
  • Call requestRepaint if markers change

Implementation

@override
@mustCallSuper
void askChangeZoomlevel(int zoomlevel, BoundingBox boundingBox, PixelProjection projection) {
  _currentMarkers?.setStop();
  _CurrentMarkers<T> currentMarkers = _CurrentMarkers(zoomlevel: zoomlevel, boundingBox: boundingBox, projection: projection);
  _currentMarkers = currentMarkers;
  unawaited(_reinitMarkers(currentMarkers, List.of(_markers)));
}