diff --git a/lib/src/layer/polygon_layer/painter.dart b/lib/src/layer/polygon_layer/painter.dart index 1adbd03f6..878bea4ea 100644 --- a/lib/src/layer/polygon_layer/painter.dart +++ b/lib/src/layer/polygon_layer/painter.dart @@ -52,10 +52,12 @@ base class _PolygonPainter required math.Point point, required LatLng coordinate, }) { - final polygon = projectedPolygon.polygon; - if (!polygon.boundingBox.contains(coordinate)) { - return false; - } + // TODO: We should check the bounding box here, for efficiency + // However, we need to account for map rotation + // + // if (!polygon.boundingBox.contains(touch)) { + // continue; + // } final projectedCoords = getOffsetsXY( camera: camera, diff --git a/lib/src/layer/polyline_layer/painter.dart b/lib/src/layer/polyline_layer/painter.dart index 3b4e25a67..1f60aee39 100644 --- a/lib/src/layer/polyline_layer/painter.dart +++ b/lib/src/layer/polyline_layer/painter.dart @@ -25,9 +25,11 @@ base class _PolylinePainter }) { final polyline = projectedPolyline.polyline; - // TODO: For efficiency we'd ideally filter by bounding box here. However - // we'd need to compute an extended bounding box that accounts account for - // the `borderStrokeWidth` & the `minimumHitbox` + // TODO: We should check the bounding box here, for efficiency + // However, we need to account for: + // * map rotation + // * extended bbox that accounts for `minimumHitbox` + // // if (!polyline.boundingBox.contains(touch)) { // continue; // } diff --git a/lib/src/layer/tile_layer/tile_layer.dart b/lib/src/layer/tile_layer/tile_layer.dart index c0b8e19e2..09c0e75f5 100644 --- a/lib/src/layer/tile_layer/tile_layer.dart +++ b/lib/src/layer/tile_layer/tile_layer.dart @@ -347,7 +347,7 @@ class _TileLayerState extends State with TickerProviderStateMixin { late final _resetSub = widget.reset?.listen((_) { _tileImageManager.removeAll(widget.evictErrorTileStrategy); - _loadAndPruneInVisibleBounds(MapCamera.of(context)); + if (mounted) _loadAndPruneInVisibleBounds(MapCamera.of(context)); }); // This is called on every map movement so we should avoid expensive logic