Plugin Keys On Map: Disable if Plugin Keys is not there

This commit is contained in:
Xelio 2013-03-27 11:15:18 +08:00
parent 9a2e004ab8
commit 308cea39f8

View File

@ -27,6 +27,10 @@ window.plugin.keysOnMap.keyLayerGroup = new L.LayerGroup();
// Use portal add and remove event to control render of keys
window.plugin.keysOnMap.portalAdded = function(data) {
// Disable if Plugin Keys is not there
if(!plugin.keys)
return;
data.portal.on('add', function() {
plugin.keysOnMap.renderKey(this.options.guid, this.getLatLng());
});
@ -37,6 +41,10 @@ window.plugin.keysOnMap.portalAdded = function(data) {
}
window.plugin.keysOnMap.keyUpdate = function(data) {
// Disable if Plugin Keys is not there
if(!plugin.keys)
return;
var portal = window.portals[data.guid];
if(!portal) return;
var latLng = portal.getLatLng();