pass dimensions to tile

This commit is contained in:
Thomas Hervey
2018-07-18 15:49:04 -04:00
parent 60f66b73e9
commit c563abaf7a
5 changed files with 6 additions and 13 deletions
+1 -1
View File
@@ -84,7 +84,7 @@ function loadTiles(which, url, projection) {
var s = projection.scale() * 2 * Math.PI;
var currZoom = Math.floor(Math.max(Math.log(s) / Math.log(2) - 8, 0));
var tiles = geoTile.filterNullIsland(geoTile.getTiles(tileZoom, projection));
var tiles = geoTile.filterNullIsland(geoTile.getTiles(tileZoom, projection, projection.clipExtent()[1], 0));
geoTile.removeInflightRequests(which, tiles, abortRequest, ',0');
tiles.forEach(function(tile) {
+1 -1
View File
@@ -79,7 +79,7 @@ function loadTiles(which, url, projection) {
var s = projection.scale() * 2 * Math.PI,
currZoom = Math.floor(Math.max(Math.log(s) / Math.log(2) - 8, 0));
var tiles = geoTile.filterNullIsland(geoTile.getTiles(tileZoom, projection));
var tiles = geoTile.filterNullIsland(geoTile.getTiles(tileZoom, projection, projection.clipExtent()[1], 0));
geoTile.removeInflightRequests(which, tiles, abortRequest, ',0');
tiles.forEach(function(tile) {
+1 -8
View File
@@ -778,15 +778,8 @@ export default {
tilezoom = _tileZoom;
}
var s = projection.scale() * 2 * Math.PI;
var z = Math.max(Math.log(s) / Math.log(2) - 8, 0);
var ts = 256 * Math.pow(2, z - tilezoom);
var origin = [
s / 2 - projection.translate()[0],
s / 2 - projection.translate()[1]
];
var tiles = geoTile.filterNullIsland(geoTile.getTiles(_tileZoom, projection));
var tiles = geoTile.filterNullIsland(geoTile.getTiles(_tileZoom, projection, dimensions, 0));
// remove inflight requests that no longer cover the view..
var hadRequests = !_isEmpty(cache.inflight);
+1 -1
View File
@@ -94,7 +94,7 @@ function loadTiles(which, url, projection, margin) {
var s = projection.scale() * 2 * Math.PI;
var currZoom = Math.floor(Math.max(Math.log(s) / Math.log(2) - 8, 0));
var tiles = geoTile.filterNullIsland(geoTile.getTiles(tileZoom, projection, margin));
var tiles = geoTile.filterNullIsland(geoTile.getTiles(tileZoom, projection, projection.clipExtent()[1], margin));
tiles.forEach(function (tile) {
loadNextTilePage(which, currZoom, url, tile);
+2 -2
View File
@@ -71,7 +71,7 @@ export function utilTile() {
* Using d3.geo.tiles.js from lib, gets tile extents for each grid tile in a grid created from
* an area around (and including) the current map view extents.
*/
tile.getTiles = function(tileZoom, projection, margin) {
tile.getTiles = function(tileZoom, projection, dimensions, margin) {
// s is the current map scale
// z is the 'Level of Detail', or zoom-level, where Level 1 is far from the earth, and Level 23 is close to the ground.
// ts ('tile size') here is the formula for determining the width/height of the map in pixels, but with a modification.
@@ -88,7 +88,7 @@ export function utilTile() {
var tiler = this
.scaleExtent([tileZoom, tileZoom])
.scale(s)
.size(projection.clipExtent()[1])
.size(dimensions)
.translate(projection.translate())
.margin(margin || 0); // request nearby tiles so we can connect sequences.