limit portals drawn to the map in dense areas, to avoid slowing down leaflet too much

unfortunately, this wasn't as much of a speed boost as i'd hoped. just downloading/processing the data for 20,000+ portals from the server, even if only 2000 are displayed, still takes a LONG time
for #526
This commit is contained in:
Jon Atkins
2013-09-03 16:24:21 +01:00
parent c0015b16cc
commit 98265766ec
2 changed files with 108 additions and 10 deletions

View File

@ -147,6 +147,7 @@ window.MapDataRequest.prototype.refresh = function() {
this.render.startRenderPass();
this.render.clearPortalsBelowLevel(minPortalLevel);
// calculate the full bounds for the data - including the part of the tiles off the screen edge
var dataBounds = L.latLngBounds([
[tileToLat(y2+1,zoom), tileToLng(x1,zoom)],
@ -156,6 +157,9 @@ window.MapDataRequest.prototype.refresh = function() {
//setTimeout (function(){ map.removeLayer(debugrect2); }, 10*1000);
this.render.clearEntitiesOutsideBounds(dataBounds);
this.render.resetPortalClusters();
console.log('requesting data tiles at zoom '+zoom+' (L'+minPortalLevel+'+ portals), map zoom is '+map.getZoom());