diff --git a/code/map_data_render.js b/code/map_data_render.js index 46998cee..5b42b2c3 100644 --- a/code/map_data_render.js +++ b/code/map_data_render.js @@ -4,6 +4,10 @@ window.Render = function() { + // below this many portals displayed, we reorder the SVG at the end of the render pass to put portals above fields/links + this.LOW_PORTAL_COUNT = 350; + + } @@ -93,6 +97,19 @@ window.Render.prototype.endRenderPass = function() { } } + // reorder portals to be after links/fields, but only if the number is low + if (Object.keys(window.portals).length <= this.LOW_PORTAL_COUNT) { + for (var i in window.portalsLayers) { + var layer = window.portalsLayers[i]; + if (window.map.hasLayer(layer)) { + layer.eachLayer (function(p) { + p.bringToFront(); + }); + } + } + + } + this.isRendering = false; }