Skip to content

Commit

Permalink
fix error by deduplicating getZoom and getCoveringZoom
Browse files Browse the repository at this point in the history
  • Loading branch information
ansis committed Nov 27, 2019
1 parent 70ad780 commit f2a3662
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/source/source_cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,13 +317,6 @@ class SourceCache extends Evented {
return this._tiles[id];
}

/**
* get the zoom level adjusted for the difference in map and source tilesizes
*/
getZoom(transform: Transform): number {
return transform.zoom + transform.scaleZoom(transform.tileSize / this._source.tileSize);
}

/**
* For a given set of tiles, retain children that are loaded and have a zoom
* between `zoom` (exclusive) and `maxCoveringZoom` (inclusive)
Expand Down Expand Up @@ -487,7 +480,7 @@ class SourceCache extends Evented {
}

// Determine the overzooming/underzooming amounts.
const zoom = (this._source.roundZoom ? Math.round : Math.floor)(this.getZoom(transform));
const zoom = transform.coveringZoomLevel(this._source);
const minCoveringZoom = Math.max(zoom - SourceCache.maxOverzooming, this._source.minzoom);
const maxCoveringZoom = Math.max(zoom + SourceCache.maxUnderzooming, this._source.minzoom);

Expand Down

0 comments on commit f2a3662

Please sign in to comment.