Fix closing alert on callback

This commit is contained in:
Yohan Boniface 2023-06-01 09:32:44 +02:00
parent cfe6bdf2a8
commit d180caa0d5

View file

@ -120,12 +120,11 @@ L.U.UI = L.Evented.extend({
el = L.DomUtil.element('a', { className: 'umap-action' }, this._alert) el = L.DomUtil.element('a', { className: 'umap-action' }, this._alert)
el.href = '#' el.href = '#'
el.textContent = action.label el.textContent = action.label
L.DomEvent.on(el, 'click', L.DomEvent.stop).on(el, 'click', close, this) L.DomEvent.on(el, 'click', L.DomEvent.stop)
if (action.callback) if (action.callback) {
L.DomEvent.on(el, 'click', () => { L.DomEvent.on(el, 'click', action.callback, action.callbackContext || this.map)
action.callback.call(action.callbackContext || this.map) }
close() L.DomEvent.on(el, 'click', close, this)
})
} }
} }
if (e.duration !== Infinity) { if (e.duration !== Infinity) {