add google_fonts dependency, implement feature inspection on map, and enhance tile cache management
This commit is contained in:
@@ -68,4 +68,9 @@ class MapboxVectorTileCache {
|
||||
_cache.remove(_cache.keys.first);
|
||||
}
|
||||
}
|
||||
|
||||
static void clear() {
|
||||
_cache.clear();
|
||||
_inFlight.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,18 +17,13 @@ class _TileCoord {
|
||||
}
|
||||
|
||||
class CachedTile {
|
||||
CachedTile(this.image, this.zoomBucket);
|
||||
CachedTile(this.image);
|
||||
|
||||
final ui.Image image;
|
||||
final int zoomBucket;
|
||||
}
|
||||
|
||||
// Static tile pyramid image cache. Stores rasterised ui.Image per (z, x, y).
|
||||
// Each entry also records the zoom bucket it was rendered at — callers can
|
||||
// check whether a re-render is warranted, but the old image stays as a
|
||||
// fallback until the new one arrives.
|
||||
//
|
||||
// Ancestor lookup (for fallback blitting) just calls peek() at a coarser z.
|
||||
// Static tile pyramid image cache. Stores one rasterised ui.Image per
|
||||
// deterministic pyramid tile coordinate (z, x, y).
|
||||
class TilePyramidCache {
|
||||
TilePyramidCache._();
|
||||
|
||||
@@ -67,7 +62,6 @@ class TilePyramidCache {
|
||||
int z,
|
||||
int x,
|
||||
int y,
|
||||
int zoomBucket,
|
||||
Future<ui.Image?> Function() render,
|
||||
void Function() onReady,
|
||||
) {
|
||||
@@ -77,14 +71,7 @@ class TilePyramidCache {
|
||||
if (filter != null && !filter(z, x, y)) return;
|
||||
_inFlight.add(coord);
|
||||
|
||||
_queue.add(
|
||||
_Queued(
|
||||
coord: coord,
|
||||
zoomBucket: zoomBucket,
|
||||
render: render,
|
||||
onReady: onReady,
|
||||
),
|
||||
);
|
||||
_queue.add(_Queued(coord: coord, render: render, onReady: onReady));
|
||||
_drain();
|
||||
}
|
||||
|
||||
@@ -118,7 +105,7 @@ class TilePyramidCache {
|
||||
existing.image.dispose();
|
||||
}
|
||||
|
||||
_cache[item.coord] = CachedTile(image, item.zoomBucket);
|
||||
_cache[item.coord] = CachedTile(image);
|
||||
_approxBytes += _estimateBytes(image);
|
||||
_trim();
|
||||
|
||||
@@ -176,13 +163,11 @@ class TilePyramidCache {
|
||||
class _Queued {
|
||||
const _Queued({
|
||||
required this.coord,
|
||||
required this.zoomBucket,
|
||||
required this.render,
|
||||
required this.onReady,
|
||||
});
|
||||
|
||||
final _TileCoord coord;
|
||||
final int zoomBucket;
|
||||
final Future<ui.Image?> Function() render;
|
||||
final void Function() onReady;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user