wip: add resize button in panel

This commit is contained in:
Yohan Boniface 2024-03-06 20:02:38 +01:00
parent af203d7b90
commit 56e6b20087

View file

@ -41,6 +41,10 @@ U.UI = L.Evented.extend({
L.DomUtil.add('i', 'umap-close-icon', closeLink) L.DomUtil.add('i', 'umap-close-icon', closeLink)
const label = L.DomUtil.create('span', '', closeLink) const label = L.DomUtil.create('span', '', closeLink)
label.title = label.textContent = L._('Close') label.title = label.textContent = L._('Close')
const resizeLink = L.DomUtil.create('li', 'umap-resize-link', actionsContainer)
L.DomUtil.add('i', 'umap-resize-icon', resizeLink)
const resizeLabel = L.DomUtil.create('span', '', resizeLink)
resizeLabel.title = resizeLabel.textContent = L._('Toggle size')
if (e.actions) { if (e.actions) {
for (let i = 0; i < e.actions.length; i++) { for (let i = 0; i < e.actions.length; i++) {
actionsContainer.appendChild(e.actions[i]) actionsContainer.appendChild(e.actions[i])
@ -62,6 +66,11 @@ U.UI = L.Evented.extend({
L.DomUtil.addClass(this.parent, 'umap-ui') L.DomUtil.addClass(this.parent, 'umap-ui')
} }
L.DomEvent.on(closeLink, 'click', this.closePanel, this) L.DomEvent.on(closeLink, 'click', this.closePanel, this)
L.DomEvent.on(resizeLink, 'click', this.resizePanel, this)
},
resizePanel: function () {
this._panel.classList.toggle('condensed')
}, },
closePanel: function () { closePanel: function () {