From 045628b00738090156a73cf4a0fd460d2fbb2dbb Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Tue, 18 Feb 2014 08:14:27 +0000 Subject: [PATCH] when clustering portals and only displaying some, sort first by level (highest first) then guid - so when some portals are removed from screen it's the lower level ones first --- code/map_data_render.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/code/map_data_render.js b/code/map_data_render.js index 198c376b..4e7e969b 100644 --- a/code/map_data_render.js +++ b/code/map_data_render.js @@ -440,14 +440,20 @@ window.Render.prototype.resetPortalClusters = function() { if (!(cid in this.portalClusters)) this.portalClusters[cid] = []; - this.portalClusters[cid].push(p.options.guid); + this.portalClusters[cid].push(pguid); } - // now, for each cluster, sort by some arbitrary data (the guid will do), and display the first CLUSTER_PORTAL_LIMIT + // now, for each cluster, sort by some arbitrary data (the level+guid will do), and display the first CLUSTER_PORTAL_LIMIT for (var cid in this.portalClusters) { var c = this.portalClusters[cid]; - c.sort(); + c.sort(function(a,b) { + var ka = (8-portals[a].options.level)+a; + var kb = (8-portals[b].options.level)+b; + if (kakb) return 1; + else return 0; + }); for (var i=0; i