From 4a4346a4199687ac90078c3120127551de1af23a Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Sun, 23 Mar 2014 20:55:32 +0000 Subject: [PATCH] max-links: only count portals visible on screen against the portal limit. the recent larger data tiles for map data pull in more off-screen data, making the old test unreliable in some cases --- plugins/max-links.user.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/plugins/max-links.user.js b/plugins/max-links.user.js index 6c46c070..91143952 100644 --- a/plugins/max-links.user.js +++ b/plugins/max-links.user.js @@ -2,7 +2,7 @@ // @id max-links@boombuler // @name IITC plugin: Max Links // @category Layer -// @version 0.4.2.@@DATETIMEVERSION@@ +// @version 0.4.3.@@DATETIMEVERSION@@ // @updateURL @@UPDATEURL@@ // @downloadURL @@DOWNLOADURL@@ // @description [@@BUILDNAME@@-@@BUILDDATE@@] Calculate how to link the portals to create a reasonably tidy set of links/fields. Enable from the layer chooser. (Max Links is a poor name, but remains for historical reasons.) @@ -68,11 +68,6 @@ window.plugin.maxLinks.updateLayer = function() { window.plugin.maxLinks.layer.clearLayers(); - if (Object.keys(window.portals).length > window.plugin.maxLinks.MAX_PORTALS_TO_LINK) { - window.plugin.maxLinks.addErrorMarker(); - return; - } - var locations = []; var bounds = map.getBounds(); @@ -81,9 +76,15 @@ window.plugin.maxLinks.updateLayer = function() { if (bounds.contains(ll)) { var p = map.project (portal.getLatLng(), window.plugin.maxLinks.PROJECT_ZOOM); locations.push(p); + if (locations.length > window.plugin.maxLinks.MAX_PORTALS_TO_LINK) return false; //$.each break } }); + if (locations.length > window.plugin.maxLinks.MAX_PORTALS_TO_LINK) { + window.plugin.maxLinks.addErrorMarker(); + return; + } + var triangles = window.delaunay.triangulate(locations); var drawnLinkCount = 0;