diff --git a/devtools_options.yaml b/devtools_options.yaml new file mode 100644 index 0000000..fa0b357 --- /dev/null +++ b/devtools_options.yaml @@ -0,0 +1,3 @@ +description: This file stores settings for Dart & Flutter DevTools. +documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states +extensions: diff --git a/lib/screens/home_screen.dart b/lib/screens/home_screen.dart index b7e173c..e5d9642 100644 --- a/lib/screens/home_screen.dart +++ b/lib/screens/home_screen.dart @@ -131,10 +131,7 @@ class _DownloadAreaDialogState extends State { } final minZoom = OfflineAreaService().findDynamicMinZoom(bounds); final maxZoom = _zoom.toInt(); - final allTiles = OfflineAreaService().computeTileList(bounds, minZoom, maxZoom); - final worldTiles = OfflineAreaService().computeTileList( - OfflineAreaService().globalWorldBounds(), 1, 4); - final nTiles = allTiles.length + worldTiles.length; + final nTiles = OfflineAreaService().computeTileList(bounds, minZoom, maxZoom).length; const kbPerTile = 6.5; // Empirically ~6.5kB average for OSM tiles at z=1-19 final totalMb = (nTiles * kbPerTile) / 1024.0; setState(() { diff --git a/lib/services/offline_area_service.dart b/lib/services/offline_area_service.dart index b8e2e19..e8407dd 100644 --- a/lib/services/offline_area_service.dart +++ b/lib/services/offline_area_service.dart @@ -193,10 +193,13 @@ class OfflineAreaService { await saveAreasToDisk(); try { - // STEP 1: Tiles (incl. global z=1..4) - final tileTasks = computeTileList(bounds, minZoom, maxZoom); - final globalTiles = computeTileList(globalWorldBounds(), 1, 4); - final allTiles = {...tileTasks, ...globalTiles}; + // STEP 1: Tiles: user areas get only their bbox/zooms; world area gets only global z=1..4 + Set> allTiles; + if (area.isPermanent) { + allTiles = computeTileList(globalWorldBounds(), 1, 4); + } else { + allTiles = computeTileList(bounds, minZoom, maxZoom); + } area.tilesTotal = allTiles.length; int done = 0;