Only close ui panel if it is open

When calling ui.closePanel, this will fire "panel:closed", which
is listened by uMap to blindly call map.invalidateSize, which
creates trouble in the dashboard preview: when pressing twice ESC
key (eg. when switching from a preview to another), the map would pan once
to the north east (I guess because invalidateSize is called while
the map is not displayed, but not sure).
This commit is contained in:
Yohan Boniface 2024-01-03 21:25:20 +01:00
parent 36f72e3154
commit d54b0e94b7

View file

@ -64,8 +64,10 @@ L.U.UI = L.Evented.extend({
},
closePanel: function () {
if (L.DomUtil.hasClass(this.parent, 'umap-ui')) {
L.DomUtil.removeClass(this.parent, 'umap-ui')
this.fire('panel:closed')
}
},
alert: function (e) {