mirror of
https://github.com/umap-project/umap.git
synced 2025-04-29 20:02:36 +02:00
Merge pull request #1958 from umap-project/broken-help
fix: main help button from edit toolbar was broken
This commit is contained in:
commit
4ae47de8a9
3 changed files with 34 additions and 35 deletions
|
@ -191,42 +191,43 @@ export default class Help {
|
||||||
show(entries) {
|
show(entries) {
|
||||||
const container = DomUtil.add('div')
|
const container = DomUtil.add('div')
|
||||||
DomUtil.createTitle(container, translate('Help'))
|
DomUtil.createTitle(container, translate('Help'))
|
||||||
// Special dynamic case. Do we still think this dialog is usefull ?
|
for (const name of entries) {
|
||||||
if (entries === 'edit') {
|
|
||||||
DomUtil.element({
|
DomUtil.element({
|
||||||
tagName: 'div',
|
tagName: 'div',
|
||||||
className: 'umap-help-entry',
|
className: 'umap-help-entry',
|
||||||
parent: container,
|
parent: container,
|
||||||
}).appendChild(this._buildEditEntry())
|
innerHTML: ENTRIES[name],
|
||||||
} else {
|
})
|
||||||
for (const name of entries) {
|
|
||||||
DomUtil.element({
|
|
||||||
tagName: 'div',
|
|
||||||
className: 'umap-help-entry',
|
|
||||||
parent: container,
|
|
||||||
innerHTML: ENTRIES[name],
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
this.dialog.open({ template: container, className: 'dark', cancel: false, accept: false })
|
this.dialog.open({ template: container, className: 'dark', cancel: false, accept: false })
|
||||||
}
|
}
|
||||||
|
|
||||||
button(container, entries, classname) {
|
// Special dynamic case. Do we still think this dialog is useful?
|
||||||
|
showGetStarted() {
|
||||||
|
const container = DomUtil.add('div')
|
||||||
|
DomUtil.createTitle(container, translate('Where do we go from here?'))
|
||||||
|
DomUtil.element({
|
||||||
|
tagName: 'div',
|
||||||
|
className: 'umap-help-entry',
|
||||||
|
parent: container,
|
||||||
|
}).appendChild(this._buildEditEntry())
|
||||||
|
this.map.dialog.open({ content: container, className: 'dark' })
|
||||||
|
}
|
||||||
|
|
||||||
|
button(container, entries) {
|
||||||
const button = DomUtil.createButton(
|
const button = DomUtil.createButton(
|
||||||
classname || 'umap-help-button',
|
'umap-help-button',
|
||||||
container,
|
container,
|
||||||
translate('Help')
|
translate('Help')
|
||||||
)
|
)
|
||||||
entries = typeof entries === 'string' ? [entries] : entries
|
button.addEventListener('click', () => this.show(entries))
|
||||||
DomEvent.on(button, 'click', DomEvent.stop).on(button, 'click', () =>
|
|
||||||
this.show(entries)
|
|
||||||
)
|
|
||||||
return button
|
return button
|
||||||
}
|
}
|
||||||
|
|
||||||
link(container, entries) {
|
getStartedLink(container) {
|
||||||
const button = this.button(container, entries, 'umap-help-link')
|
const button = DomUtil.createButton('umap-help-link', container, translate('Help'))
|
||||||
button.textContent = translate('Help')
|
button.textContent = translate('Help')
|
||||||
|
button.addEventListener('click', () => this.showGetStarted())
|
||||||
return button
|
return button
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,7 +239,6 @@ export default class Help {
|
||||||
|
|
||||||
_buildEditEntry() {
|
_buildEditEntry() {
|
||||||
const container = DomUtil.create('div', '')
|
const container = DomUtil.create('div', '')
|
||||||
const title = DomUtil.create('h4', '', container)
|
|
||||||
const actionsContainer = DomUtil.create('ul', 'umap-edit-actions', container)
|
const actionsContainer = DomUtil.create('ul', 'umap-edit-actions', container)
|
||||||
const addAction = (action) => {
|
const addAction = (action) => {
|
||||||
const actionContainer = DomUtil.add('li', '', actionsContainer)
|
const actionContainer = DomUtil.add('li', '', actionsContainer)
|
||||||
|
@ -247,7 +247,6 @@ export default class Help {
|
||||||
DomEvent.on(actionContainer, 'click', action.addHooks, action)
|
DomEvent.on(actionContainer, 'click', action.addHooks, action)
|
||||||
DomEvent.on(actionContainer, 'click', this.dialog.close, this.dialog)
|
DomEvent.on(actionContainer, 'click', this.dialog.close, this.dialog)
|
||||||
}
|
}
|
||||||
title.textContent = translate('Where do we go from here?')
|
|
||||||
for (const id in this.map.helpMenuActions) {
|
for (const id in this.map.helpMenuActions) {
|
||||||
addAction(this.map.helpMenuActions[id])
|
addAction(this.map.helpMenuActions[id])
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ export const SCHEMA = {
|
||||||
impacts: ['data'],
|
impacts: ['data'],
|
||||||
handler: 'ColorPicker',
|
handler: 'ColorPicker',
|
||||||
label: translate('color'),
|
label: translate('color'),
|
||||||
helpEntries: 'colorValue',
|
helpEntries: ['colorValue'],
|
||||||
inheritable: true,
|
inheritable: true,
|
||||||
default: 'DarkBlue',
|
default: 'DarkBlue',
|
||||||
},
|
},
|
||||||
|
@ -69,7 +69,7 @@ export const SCHEMA = {
|
||||||
type: String,
|
type: String,
|
||||||
impacts: ['data'],
|
impacts: ['data'],
|
||||||
label: translate('dash array'),
|
label: translate('dash array'),
|
||||||
helpEntries: 'dashArray',
|
helpEntries: ['dashArray'],
|
||||||
inheritable: true,
|
inheritable: true,
|
||||||
},
|
},
|
||||||
datalayersControl: {
|
datalayersControl: {
|
||||||
|
@ -96,7 +96,7 @@ export const SCHEMA = {
|
||||||
type: 'Text',
|
type: 'Text',
|
||||||
impacts: ['ui'],
|
impacts: ['ui'],
|
||||||
label: translate('description'),
|
label: translate('description'),
|
||||||
helpEntries: 'textFormatting',
|
helpEntries: ['textFormatting'],
|
||||||
},
|
},
|
||||||
displayOnLoad: {
|
displayOnLoad: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
@ -135,7 +135,7 @@ export const SCHEMA = {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
impacts: ['data'],
|
impacts: ['data'],
|
||||||
label: translate('fill'),
|
label: translate('fill'),
|
||||||
helpEntries: 'fill',
|
helpEntries: ['fill'],
|
||||||
inheritable: true,
|
inheritable: true,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
@ -144,7 +144,7 @@ export const SCHEMA = {
|
||||||
impacts: ['data'],
|
impacts: ['data'],
|
||||||
handler: 'ColorPicker',
|
handler: 'ColorPicker',
|
||||||
label: translate('fill color'),
|
label: translate('fill color'),
|
||||||
helpEntries: 'fillColor',
|
helpEntries: ['fillColor'],
|
||||||
inheritable: true,
|
inheritable: true,
|
||||||
},
|
},
|
||||||
fillOpacity: {
|
fillOpacity: {
|
||||||
|
@ -220,7 +220,7 @@ export const SCHEMA = {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
impacts: ['data'],
|
impacts: ['data'],
|
||||||
label: translate('Allow interactions'),
|
label: translate('Allow interactions'),
|
||||||
helpEntries: 'interactive',
|
helpEntries: ['interactive'],
|
||||||
inheritable: true,
|
inheritable: true,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
@ -247,7 +247,7 @@ export const SCHEMA = {
|
||||||
labelKey: {
|
labelKey: {
|
||||||
type: String,
|
type: String,
|
||||||
impacts: ['data'],
|
impacts: ['data'],
|
||||||
helpEntries: 'labelKey',
|
helpEntries: ['labelKey'],
|
||||||
placeholder: translate('Default: name'),
|
placeholder: translate('Default: name'),
|
||||||
label: translate('Label key'),
|
label: translate('Label key'),
|
||||||
inheritable: true,
|
inheritable: true,
|
||||||
|
@ -323,7 +323,7 @@ export const SCHEMA = {
|
||||||
type: String,
|
type: String,
|
||||||
impacts: [],
|
impacts: [],
|
||||||
label: translate('Link to…'),
|
label: translate('Link to…'),
|
||||||
helpEntries: 'outlink',
|
helpEntries: ['outlink'],
|
||||||
placeholder: 'http://...',
|
placeholder: 'http://...',
|
||||||
inheritable: true,
|
inheritable: true,
|
||||||
},
|
},
|
||||||
|
@ -445,7 +445,7 @@ export const SCHEMA = {
|
||||||
max: 10,
|
max: 10,
|
||||||
step: 0.5,
|
step: 0.5,
|
||||||
label: translate('Simplify'),
|
label: translate('Simplify'),
|
||||||
helpEntries: 'smoothFactor',
|
helpEntries: ['smoothFactor'],
|
||||||
inheritable: true,
|
inheritable: true,
|
||||||
default: 1.0,
|
default: 1.0,
|
||||||
},
|
},
|
||||||
|
@ -463,7 +463,7 @@ export const SCHEMA = {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
impacts: ['data'],
|
impacts: ['data'],
|
||||||
label: translate('stroke'),
|
label: translate('stroke'),
|
||||||
helpEntries: 'stroke',
|
helpEntries: ['stroke'],
|
||||||
inheritable: true,
|
inheritable: true,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
@ -471,7 +471,7 @@ export const SCHEMA = {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
impacts: ['sync', 'ui'],
|
impacts: ['sync', 'ui'],
|
||||||
label: translate('Enable real-time collaboration'),
|
label: translate('Enable real-time collaboration'),
|
||||||
helpEntries: 'sync',
|
helpEntries: ['sync'],
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
tilelayer: {
|
tilelayer: {
|
||||||
|
@ -530,7 +530,7 @@ export const SCHEMA = {
|
||||||
type: Number,
|
type: Number,
|
||||||
impacts: [], // not need to update the view
|
impacts: [], // not need to update the view
|
||||||
placeholder: translate('Inherit'),
|
placeholder: translate('Inherit'),
|
||||||
helpEntries: 'zoomTo',
|
helpEntries: ['zoomTo'],
|
||||||
label: translate('Default zoom level'),
|
label: translate('Default zoom level'),
|
||||||
inheritable: true,
|
inheritable: true,
|
||||||
},
|
},
|
||||||
|
|
|
@ -751,7 +751,7 @@ const ControlsMixin = {
|
||||||
this.options.user.url
|
this.options.user.url
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
this.help.link(rightContainer, 'edit')
|
this.help.getStartedLink(rightContainer)
|
||||||
const controlEditCancel = L.DomUtil.createButton(
|
const controlEditCancel = L.DomUtil.createButton(
|
||||||
'leaflet-control-edit-cancel',
|
'leaflet-control-edit-cancel',
|
||||||
rightContainer,
|
rightContainer,
|
||||||
|
|
Loading…
Reference in a new issue