mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-30 03:39:36 +02:00
Move cache management out of tiler, it's responsibilty of service
Also remove some unused code and eslint warnings
This commit is contained in:
+5
-16
@@ -1,5 +1,3 @@
|
||||
import _filter from 'lodash-es/filter';
|
||||
import _find from 'lodash-es/find';
|
||||
import { range as d3_range } from 'd3-array';
|
||||
import { geoExtent } from '../geo';
|
||||
|
||||
@@ -19,7 +17,10 @@ export function utilTiler() {
|
||||
}
|
||||
|
||||
|
||||
function nearNullIsland(x, y, z) {
|
||||
function nearNullIsland(tile) {
|
||||
var x = tile[0];
|
||||
var y = tile[1];
|
||||
var z = tile[2];
|
||||
if (z >= 7) {
|
||||
var center = Math.pow(2, z - 1);
|
||||
var width = Math.pow(2, z - 6);
|
||||
@@ -93,7 +94,7 @@ export function utilTiler() {
|
||||
|
||||
return tiler()
|
||||
.map(function(tile) {
|
||||
if (_skipNullIsland && nearNullIsland(tile[0], tile[1], tile[2])) {
|
||||
if (_skipNullIsland && nearNullIsland(tile)) {
|
||||
return false;
|
||||
}
|
||||
var x = tile[0] * ts - origin[0];
|
||||
@@ -110,18 +111,6 @@ export function utilTiler() {
|
||||
};
|
||||
|
||||
|
||||
// remove inflight requests that no longer cover the view..
|
||||
tiler.removeInflightRequests = function(cache, tiles, callback, modifier) {
|
||||
return _filter(cache.inflight, function(v, i) {
|
||||
var wanted = _find(tiles, function(tile) { return i === tile.id + modifier; });
|
||||
if (!wanted) {
|
||||
delete cache.inflight[i];
|
||||
}
|
||||
return !wanted;
|
||||
}).map(callback); // abort request
|
||||
};
|
||||
|
||||
|
||||
tiler.scaleExtent = function(val) {
|
||||
if (!arguments.length) return _scaleExtent;
|
||||
_scaleExtent = val;
|
||||
|
||||
Reference in New Issue
Block a user