mirror of
https://github.com/umap-project/umap.git
synced 2025-05-05 22:11:50 +02:00
feat: make popup panel expanded by default and add a small panel
cf https://forum.openstreetmap.fr/t/umap-2-3-changement-de-gestion-des-pop-up/23680
This commit is contained in:
parent
a1084e0c7b
commit
63f8943f3d
4 changed files with 11 additions and 3 deletions
|
@ -14,7 +14,8 @@ export class Panel {
|
||||||
DomEvent.on(this.container, 'MozMousePixelScroll', DomEvent.stopPropagation)
|
DomEvent.on(this.container, 'MozMousePixelScroll', DomEvent.stopPropagation)
|
||||||
}
|
}
|
||||||
|
|
||||||
open({ content, className, actions = [] } = {}) {
|
open({ content, className, actions = [], mode = null } = {}) {
|
||||||
|
if (mode) this.mode = mode
|
||||||
this.container.className = `with-transition panel ${this.classname} ${this.mode}`
|
this.container.className = `with-transition panel ${this.classname} ${this.mode}`
|
||||||
this.container.innerHTML = ''
|
this.container.innerHTML = ''
|
||||||
const actionsContainer = DomUtil.create('ul', 'toolbox', this.container)
|
const actionsContainer = DomUtil.create('ul', 'toolbox', this.container)
|
||||||
|
|
|
@ -341,6 +341,7 @@ export const SCHEMA = {
|
||||||
['Default', translate('Popup')],
|
['Default', translate('Popup')],
|
||||||
['Large', translate('Popup (large)')],
|
['Large', translate('Popup (large)')],
|
||||||
['Panel', translate('Side panel')],
|
['Panel', translate('Side panel')],
|
||||||
|
['SmallPanel', translate('Small side panel')],
|
||||||
],
|
],
|
||||||
default: 'Default',
|
default: 'Default',
|
||||||
},
|
},
|
||||||
|
|
|
@ -218,7 +218,6 @@ U.Map = L.Map.extend({
|
||||||
} else if (this.options.onLoadPanel === 'datalayers') {
|
} else if (this.options.onLoadPanel === 'datalayers') {
|
||||||
this.openBrowser('layers')
|
this.openBrowser('layers')
|
||||||
} else if (this.options.onLoadPanel === 'datafilters') {
|
} else if (this.options.onLoadPanel === 'datafilters') {
|
||||||
this.panel.mode = 'expanded'
|
|
||||||
this.openBrowser('filters')
|
this.openBrowser('filters')
|
||||||
} else if (this.options.onLoadPanel === 'caption') {
|
} else if (this.options.onLoadPanel === 'caption') {
|
||||||
this.panel.mode = 'condensed'
|
this.panel.mode = 'condensed'
|
||||||
|
|
|
@ -52,12 +52,14 @@ U.Popup.Large = U.Popup.extend({
|
||||||
U.Popup.Panel = U.Popup.extend({
|
U.Popup.Panel = U.Popup.extend({
|
||||||
options: {
|
options: {
|
||||||
zoomAnimation: false,
|
zoomAnimation: false,
|
||||||
|
mode: 'expanded',
|
||||||
},
|
},
|
||||||
|
|
||||||
onAdd: function (map) {
|
onAdd: function (map) {
|
||||||
map.panel.open({
|
map.panel.open({
|
||||||
content: this._content,
|
content: this._content,
|
||||||
actions: [U.Browser.backButton(map)],
|
actions: [U.Browser.backButton(map)],
|
||||||
|
mode: this.options.mode,
|
||||||
})
|
})
|
||||||
|
|
||||||
// fire events as in base class Popup.js:onAdd
|
// fire events as in base class Popup.js:onAdd
|
||||||
|
@ -90,7 +92,12 @@ U.Popup.Panel = U.Popup.extend({
|
||||||
_animateZoom: function () {},
|
_animateZoom: function () {},
|
||||||
})
|
})
|
||||||
U.Popup.SimplePanel = U.Popup.Panel // Retrocompat.
|
U.Popup.SimplePanel = U.Popup.Panel // Retrocompat.
|
||||||
|
U.Popup.SmallPanel = U.Popup.Panel.extend({
|
||||||
|
options: {
|
||||||
|
zoomAnimation: false,
|
||||||
|
mode: 'condensed',
|
||||||
|
},
|
||||||
|
})
|
||||||
/* Content templates */
|
/* Content templates */
|
||||||
|
|
||||||
U.PopupTemplate = {}
|
U.PopupTemplate = {}
|
||||||
|
|
Loading…
Reference in a new issue