From 268c9ebb3ab5e902b30550c864c5bf07126706ee Mon Sep 17 00:00:00 2001 From: stopflock Date: Tue, 19 Aug 2025 17:54:27 -0500 Subject: [PATCH] min zoom for offline areas is now max world zoom + 1 --- lib/screens/home_screen.dart | 2 +- lib/services/offline_areas/offline_tile_utils.dart | 11 ----------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/lib/screens/home_screen.dart b/lib/screens/home_screen.dart index c8a55d0..4a56a5e 100644 --- a/lib/screens/home_screen.dart +++ b/lib/screens/home_screen.dart @@ -198,7 +198,7 @@ class _DownloadAreaDialogState extends State { LatLng(bounds.northEast.latitude, bounds.northEast.longitude + epsilon) ); } - final minZoom = findDynamicMinZoom(bounds); + final minZoom = kWorldMaxZoom + 1; // Use world max zoom + 1 for seamless zoom experience final maxZoom = _zoom.toInt(); final nTiles = computeTileList(bounds, minZoom, maxZoom).length; final totalMb = (nTiles * kTileEstimateKb) / 1024.0; diff --git a/lib/services/offline_areas/offline_tile_utils.dart b/lib/services/offline_areas/offline_tile_utils.dart index 071354e..9c987fc 100644 --- a/lib/services/offline_areas/offline_tile_utils.dart +++ b/lib/services/offline_areas/offline_tile_utils.dart @@ -56,17 +56,6 @@ List latLonToTile(double lat, double lon, int zoom) { return [xtile, ytile]; } -int findDynamicMinZoom(LatLngBounds bounds, {int maxSearchZoom = 19}) { - for (int z = 1; z <= maxSearchZoom; z++) { - final swTile = latLonToTile(bounds.southWest.latitude, bounds.southWest.longitude, z); - final neTile = latLonToTile(bounds.northEast.latitude, bounds.northEast.longitude, z); - if (swTile[0] != neTile[0] || swTile[1] != neTile[1]) { - return z - 1 > 0 ? z - 1 : 1; - } - } - return maxSearchZoom; -} - LatLngBounds globalWorldBounds() { // Use slightly shrunken bounds to avoid tile index overflow at extreme coordinates return LatLngBounds(LatLng(-85.0, -179.9), LatLng(85.0, 179.9));