From 563258a8976c12396e8594430051a0fd08233130 Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Tue, 27 Aug 2013 16:31:45 +0100 Subject: [PATCH] sort portal layers so they're above links/fields - but only when there's not that many a lot of redrawing occurs when sorting portals - so only ordering when there's a low number keeps things reasonably fast --- code/map_data_render.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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; }