bugfix: update portal level layer if it already exists instead of ignoring the addLabel call
This commit is contained in:
parent
5a033a971a
commit
64bd129c02
@ -52,9 +52,12 @@ window.plugin.portalLevelNumbers.removeLabel = function(guid) {
|
||||
}
|
||||
|
||||
window.plugin.portalLevelNumbers.addLabel = function(guid,latLng) {
|
||||
var previousLayer = window.plugin.portalLevelNumbers.levelLayers[guid];
|
||||
if (!previousLayer) {
|
||||
|
||||
// remove old layer before updating
|
||||
var previousLayer = window.plugin.portalLevelNumbers.levelLayers[guid];
|
||||
if (previousLayer) window.plugin.portalLevelNumbers.removeLabel(guid);
|
||||
|
||||
// add portal level to layers
|
||||
var p = window.portals[guid];
|
||||
var levelNumber = p.options.level;
|
||||
var level = L.marker(latLng, {
|
||||
@ -68,7 +71,6 @@ window.plugin.portalLevelNumbers.addLabel = function(guid,latLng) {
|
||||
plugin.portalLevelNumbers.levelLayers[guid] = level;
|
||||
level.addTo(plugin.portalLevelNumbers.levelLayerGroup);
|
||||
}
|
||||
}
|
||||
|
||||
window.plugin.portalLevelNumbers.updatePortalLabels = function() {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user