merge parts of #236 (by ShawnTuatara)
This commit is contained in:
parent
71d769c3ec
commit
0ada93ea75
@ -11,7 +11,7 @@
|
||||
//
|
||||
// Boot hook: booting is handled differently because IITC may not yet
|
||||
// be available. Have a look at the plugins in plugins/. All
|
||||
// code before “// PLUGIN START” and after “// PLUGIN END” os
|
||||
// code before “// PLUGIN START” and after “// PLUGIN END” is
|
||||
// required to successfully boot the plugin.
|
||||
//
|
||||
// Here’s more specific information about each event:
|
||||
@ -36,6 +36,16 @@
|
||||
// array [GUID, time, details]. Plugin can manipulate the
|
||||
// array to change order or add additional values to the
|
||||
// details of a portal.
|
||||
// beforePortalReRender: the callback argument is
|
||||
// {portal: ent[2], oldPortal : d, reRender : false}.
|
||||
// The callback needs to update the value of reRender to
|
||||
// true if the plugin has a reason to have the portal
|
||||
// redrawn. It is called early on in the
|
||||
// code/map_data.js#renderPortal as long as there was an
|
||||
// old portal for the guid.
|
||||
|
||||
|
||||
|
||||
|
||||
window._hooks = {}
|
||||
window.VALID_HOOKS = ['portalAdded', 'portalDetailsUpdated',
|
||||
|
@ -231,8 +231,16 @@ window.renderPortal = function(ent) {
|
||||
var old = findEntityInLeaflet(layerGroup, window.portals, ent[0]);
|
||||
if(old) {
|
||||
var oo = old.options;
|
||||
|
||||
// Default checks to see if a portal needs to be re-rendered
|
||||
var u = oo.team !== team;
|
||||
u = u || oo.level !== portalLevel;
|
||||
|
||||
// Allow plugins to add additional conditions as to when a portal gets re-rendered
|
||||
var hookData = {portal: ent[2], oldPortal: oo.details, reRender: false};
|
||||
runHooks('beforePortalReRender', hookData);
|
||||
u = u || hookData.reRender;
|
||||
|
||||
// nothing changed that requires re-rendering the portal.
|
||||
if(!u) {
|
||||
// let resos handle themselves if they need to be redrawn
|
||||
|
Loading…
x
Reference in New Issue
Block a user