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,22 +52,24 @@ window.plugin.portalLevelNumbers.removeLabel = function(guid) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
window.plugin.portalLevelNumbers.addLabel = function(guid,latLng) {
|
window.plugin.portalLevelNumbers.addLabel = function(guid,latLng) {
|
||||||
var previousLayer = window.plugin.portalLevelNumbers.levelLayers[guid];
|
|
||||||
if (!previousLayer) {
|
|
||||||
|
|
||||||
var p = window.portals[guid];
|
// remove old layer before updating
|
||||||
var levelNumber = p.options.level;
|
var previousLayer = window.plugin.portalLevelNumbers.levelLayers[guid];
|
||||||
var level = L.marker(latLng, {
|
if (previousLayer) window.plugin.portalLevelNumbers.removeLabel(guid);
|
||||||
icon: L.divIcon({
|
|
||||||
className: 'plugin-portal-level-numbers',
|
// add portal level to layers
|
||||||
iconSize: [window.plugin.portalLevelNumbers.ICON_SIZE, window.plugin.portalLevelNumbers.ICON_SIZE],
|
var p = window.portals[guid];
|
||||||
html: levelNumber
|
var levelNumber = p.options.level;
|
||||||
}),
|
var level = L.marker(latLng, {
|
||||||
guid: guid
|
icon: L.divIcon({
|
||||||
});
|
className: 'plugin-portal-level-numbers',
|
||||||
plugin.portalLevelNumbers.levelLayers[guid] = level;
|
iconSize: [window.plugin.portalLevelNumbers.ICON_SIZE, window.plugin.portalLevelNumbers.ICON_SIZE],
|
||||||
level.addTo(plugin.portalLevelNumbers.levelLayerGroup);
|
html: levelNumber
|
||||||
}
|
}),
|
||||||
|
guid: guid
|
||||||
|
});
|
||||||
|
plugin.portalLevelNumbers.levelLayers[guid] = level;
|
||||||
|
level.addTo(plugin.portalLevelNumbers.levelLayerGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
window.plugin.portalLevelNumbers.updatePortalLabels = function() {
|
window.plugin.portalLevelNumbers.updatePortalLabels = function() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user