From de5b689ee6f003858282e91307c4520471c0b3bf Mon Sep 17 00:00:00 2001 From: Joseph Verburg Date: Wed, 8 Apr 2015 17:03:53 +0200 Subject: [PATCH] Added remove events for portals/links/fields. --- code/hooks.js | 4 ++++ code/map_data_render.js | 3 +++ 2 files changed, 7 insertions(+) diff --git a/code/hooks.js b/code/hooks.js index 2fd82477..fda12aa3 100644 --- a/code/hooks.js +++ b/code/hooks.js @@ -28,6 +28,9 @@ // the Leaflet CircleMarker for the portal in "portal" var. // linkAdded: called when a link is about to be added to the map // fieldAdded: called when a field is about to be added to the map +// portalRemoved: called when a portal has been removed +// linkRemoved: called when a link has been removed +// fieldRemoved: called when a field has been removed // portalDetailsUpdated: fired after the details in the sidebar have // been (re-)rendered Provides data about the portal that // has been selected. @@ -57,6 +60,7 @@ window.VALID_HOOKS = [ 'portalSelected', 'portalDetailsUpdated', 'mapDataRefreshStart', 'mapDataRefreshEnd', 'portalAdded', 'linkAdded', 'fieldAdded', + 'portalRemoved', 'linkRemoved', 'fieldRemoved', 'publicChatDataAvailable', 'factionChatDataAvailable', 'requestFinished', 'nicknameClicked', 'geoSearch', 'search', 'iitcLoaded', diff --git a/code/map_data_render.js b/code/map_data_render.js index a113620b..13194d35 100644 --- a/code/map_data_render.js +++ b/code/map_data_render.js @@ -240,6 +240,7 @@ window.Render.prototype.deletePortalEntity = function(guid) { window.ornaments.removePortal(p); this.removePortalFromMapLayer(p); delete window.portals[guid]; + window.runHooks('portalRemoved', {portal: p, data: p.options.data }); } } @@ -248,6 +249,7 @@ window.Render.prototype.deleteLinkEntity = function(guid) { var l = window.links[guid]; linksFactionLayers[l.options.team].removeLayer(l); delete window.links[guid]; + window.runHooks('linkRemoved', {link: l, data: l.options.data }); } } @@ -259,6 +261,7 @@ window.Render.prototype.deleteFieldEntity = function(guid) { fieldsFactionLayers[f.options.team].removeLayer(f); delete window.fields[guid]; + window.runHooks('fieldRemoved', {field: f, data: f.options.data }); } }