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
This commit is contained in:
parent
95ed0ddd7b
commit
4a4346a419
@ -2,7 +2,7 @@
|
|||||||
// @id max-links@boombuler
|
// @id max-links@boombuler
|
||||||
// @name IITC plugin: Max Links
|
// @name IITC plugin: Max Links
|
||||||
// @category Layer
|
// @category Layer
|
||||||
// @version 0.4.2.@@DATETIMEVERSION@@
|
// @version 0.4.3.@@DATETIMEVERSION@@
|
||||||
// @updateURL @@UPDATEURL@@
|
// @updateURL @@UPDATEURL@@
|
||||||
// @downloadURL @@DOWNLOADURL@@
|
// @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.)
|
// @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();
|
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 locations = [];
|
||||||
|
|
||||||
var bounds = map.getBounds();
|
var bounds = map.getBounds();
|
||||||
@ -81,9 +76,15 @@ window.plugin.maxLinks.updateLayer = function() {
|
|||||||
if (bounds.contains(ll)) {
|
if (bounds.contains(ll)) {
|
||||||
var p = map.project (portal.getLatLng(), window.plugin.maxLinks.PROJECT_ZOOM);
|
var p = map.project (portal.getLatLng(), window.plugin.maxLinks.PROJECT_ZOOM);
|
||||||
locations.push(p);
|
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 triangles = window.delaunay.triangulate(locations);
|
||||||
|
|
||||||
var drawnLinkCount = 0;
|
var drawnLinkCount = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user