Added remove events for portals/links/fields.

This commit is contained in:
Joseph Verburg
2015-04-08 17:03:53 +02:00
parent c7595c85f8
commit de5b689ee6
2 changed files with 7 additions and 0 deletions

View File

@ -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',

View File

@ -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 });
}
}