Skip to content

Commit

Permalink
Add tile scale calculations to the cache
Browse files Browse the repository at this point in the history
  • Loading branch information
rorystephenson committed Mar 31, 2023
1 parent 2c8dcde commit c26d47f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/src/layer/tile_layer/tile_scale_calculator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ class TileScaleCalculator {
/// Returns a scale value to transform a Tile coordainte to a Tile position.
double scaledTileSize(double currentZoom, int tileZoom) {
assert(_cachedCurrentZoom == currentZoom);
return _scaledTileSizeImpl(currentZoom, tileZoom);
return _cache.putIfAbsent(
tileZoom,
() => _scaledTileSizeImpl(currentZoom, tileZoom),
);
}

double _scaledTileSizeImpl(double currentZoom, int tileZoom) {
Expand Down

0 comments on commit c26d47f

Please sign in to comment.