From 7d3ca0972bd51474026643366a928db5395266e9 Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Thu, 5 Sep 2013 22:14:52 +0100 Subject: [PATCH] better selected portal handling - ensure the selected portal isn't deleted when it isn't in the map data (e.g. due to zoom level) - always show the selected portal on the map, even if the high density clustering code would have removed it - deselect the selected portal, and clear the details bar, in the rare instance of the portal being deleted server-side (i.e. in the deletedEntities list) --- code/map_data_render.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/code/map_data_render.js b/code/map_data_render.js index db34d26e..39ad70a7 100644 --- a/code/map_data_render.js +++ b/code/map_data_render.js @@ -83,6 +83,11 @@ window.Render.prototype.processDeletedGameEntityGuids = function(deleted) { if ( !(guid in this.deletedGuid) ) { this.deletedGuid[guid] = true; // flag this guid as having being processed + if (guid == selectedPortal) { + // the rare case of the selected portal being deleted. clear the details tab and deselect it + renderPortalDetails(null); + } + this.deleteEntity(guid); } @@ -114,7 +119,7 @@ window.Render.prototype.endRenderPass = function() { // check to see if there's eny entities we haven't seen. if so, delete them for (var guid in window.portals) { - if (!(guid in this.seenPortalsGuid)) { + if (!(guid in this.seenPortalsGuid) && guid !== selectedPortal) { this.deletePortalEntity(guid); } } @@ -501,12 +506,13 @@ window.Render.prototype.resetPortalClusters = function() { for (var i=0; i