Interface option to hide caption menus

This commit is contained in:
3st3ban3 2023-01-14 23:15:27 +01:00
parent 57ba42061c
commit 423084e9ea
3 changed files with 35 additions and 21 deletions

View file

@ -954,12 +954,14 @@ L.U.AttributionControl = L.Control.Attribution.extend({
if (this._map.options.shortCredit) { if (this._map.options.shortCredit) {
L.DomUtil.add('span', '', this._container, ' — ' + L.Util.toHTML(this._map.options.shortCredit)); L.DomUtil.add('span', '', this._container, ' — ' + L.Util.toHTML(this._map.options.shortCredit));
} }
var link = L.DomUtil.add('a', '', this._container, ' — ' + L._('About')); if (this._map.options.captionMenus) {
L.DomEvent var link = L.DomUtil.add('a', '', this._container, ' — ' + L._('About'));
.on(link, 'click', L.DomEvent.stop) L.DomEvent
.on(link, 'click', this._map.displayCaption, this._map) .on(link, 'click', L.DomEvent.stop)
.on(link, 'dblclick', L.DomEvent.stop); .on(link, 'click', this._map.displayCaption, this._map)
if (window.top === window.self) { .on(link, 'dblclick', L.DomEvent.stop);
}
if (window.top === window.self && this._map.options.captionMenus) {
// We are not in iframe mode // We are not in iframe mode
var home = L.DomUtil.add('a', '', this._container, ' — ' + L._('Home')); var home = L.DomUtil.add('a', '', this._container, ' — ' + L._('Home'));
home.href = '/'; home.href = '/';
@ -1150,7 +1152,8 @@ L.U.IframeExporter = L.Evented.extend({
embedControl: null, embedControl: null,
datalayersControl: true, datalayersControl: true,
onLoadPanel: 'none', onLoadPanel: 'none',
captionBar: false captionBar: false,
captionMenus: true
}, },
dimensions: { dimensions: {

View file

@ -759,6 +759,7 @@ L.U.FormBuilder = L.FormBuilder.extend({
onLoadPanel: {handler: 'onLoadPanel', label: L._('Do you want to display a panel on load?')}, onLoadPanel: {handler: 'onLoadPanel', label: L._('Do you want to display a panel on load?')},
displayPopupFooter: {handler: 'Switch', label: L._('Do you want to display popup footer?')}, displayPopupFooter: {handler: 'Switch', label: L._('Do you want to display popup footer?')},
captionBar: {handler: 'Switch', label: L._('Do you want to display a caption bar?')}, captionBar: {handler: 'Switch', label: L._('Do you want to display a caption bar?')},
captionMenus: {handler: 'Switch', label: L._('Do you want to display caption menus?')},
zoomTo: {handler: 'IntInput', placeholder: L._('Inherit'), helpEntries: 'zoomTo', label: L._('Default zoom level'), inheritable: true}, zoomTo: {handler: 'IntInput', placeholder: L._('Inherit'), helpEntries: 'zoomTo', label: L._('Default zoom level'), inheritable: true},
showLabel: {handler: 'LabelChoice', label: L._('Display label'), inheritable: true}, showLabel: {handler: 'LabelChoice', label: L._('Display label'), inheritable: true},
labelDirection: {handler: 'LabelDirection', label: L._('Label direction'), inheritable: true}, labelDirection: {handler: 'LabelDirection', label: L._('Label direction'), inheritable: true},

View file

@ -43,6 +43,7 @@ L.Map.mergeOptions({
], ],
moreControl: true, moreControl: true,
captionBar: false, captionBar: false,
captionMenus: true,
slideshow: {}, slideshow: {},
clickable: true, clickable: true,
easing: true, easing: true,
@ -89,6 +90,7 @@ L.U.Map.include({
L.Util.setBooleanFromQueryString(this.options, 'displayDataBrowserOnLoad'); L.Util.setBooleanFromQueryString(this.options, 'displayDataBrowserOnLoad');
L.Util.setBooleanFromQueryString(this.options, 'displayCaptionOnLoad'); L.Util.setBooleanFromQueryString(this.options, 'displayCaptionOnLoad');
L.Util.setBooleanFromQueryString(this.options, 'captionBar'); L.Util.setBooleanFromQueryString(this.options, 'captionBar');
L.Util.setBooleanFromQueryString(this.options, 'captionMenus');
for (var i = 0; i < this.HIDDABLE_CONTROLS.length; i++) { for (var i = 0; i < this.HIDDABLE_CONTROLS.length; i++) {
L.Util.setNullableBooleanFromQueryString(this.options, this.HIDDABLE_CONTROLS[i] + 'Control'); L.Util.setNullableBooleanFromQueryString(this.options, this.HIDDABLE_CONTROLS[i] + 'Control');
} }
@ -628,7 +630,8 @@ L.U.Map.include({
'queryString.miniMap', 'queryString.miniMap',
'queryString.scaleControl', 'queryString.scaleControl',
'queryString.onLoadPanel', 'queryString.onLoadPanel',
'queryString.captionBar' 'queryString.captionBar',
'queryString.captionMenus'
]; ];
for (var i = 0; i < this.HIDDABLE_CONTROLS.length; i++) { for (var i = 0; i < this.HIDDABLE_CONTROLS.length; i++) {
UIFields.push('queryString.' + this.HIDDABLE_CONTROLS[i] + 'Control'); UIFields.push('queryString.' + this.HIDDABLE_CONTROLS[i] + 'Control');
@ -1067,6 +1070,7 @@ L.U.Map.include({
'popupContentTemplate', 'popupContentTemplate',
'zoomTo', 'zoomTo',
'captionBar', 'captionBar',
'captionMenus',
'slideshow', 'slideshow',
'sortKey', 'sortKey',
'labelKey', 'labelKey',
@ -1232,10 +1236,14 @@ L.U.Map.include({
'options.scaleControl', 'options.scaleControl',
'options.onLoadPanel', 'options.onLoadPanel',
'options.displayPopupFooter', 'options.displayPopupFooter',
'options.captionBar' 'options.captionBar',
'options.captionMenus'
]); ]);
builder = new L.U.FormBuilder(this, UIFields, { builder = new L.U.FormBuilder(this, UIFields, {
callback: this.renderControls, callback: function() {
this.renderControls();
this.initCaptionBar();
},
callbackContext: this callbackContext: this
}); });
var controlsOptions = L.DomUtil.createFieldset(container, L._('User interface options')); var controlsOptions = L.DomUtil.createFieldset(container, L._('User interface options'));
@ -1450,17 +1458,19 @@ L.U.Map.include({
name = L.DomUtil.create('h3', '', container); name = L.DomUtil.create('h3', '', container);
L.DomEvent.disableClickPropagation(container); L.DomEvent.disableClickPropagation(container);
this.permissions.addOwnerLink('span', container); this.permissions.addOwnerLink('span', container);
var about = L.DomUtil.add('a', 'umap-about-link', container, ' — ' + L._('About')); if (this.options.captionMenus) {
about.href = '#'; var about = L.DomUtil.add('a', 'umap-about-link', container, ' — ' + L._('About'));
L.DomEvent.on(about, 'click', this.displayCaption, this); about.href = '#';
var browser = L.DomUtil.add('a', 'umap-open-browser-link', container, ' | ' + L._('Browse data')); L.DomEvent.on(about, 'click', this.displayCaption, this);
browser.href = '#'; var browser = L.DomUtil.add('a', 'umap-open-browser-link', container, ' | ' + L._('Browse data'));
L.DomEvent.on(browser, 'click', L.DomEvent.stop) browser.href = '#';
.on(browser, 'click', this.openBrowser, this); L.DomEvent.on(browser, 'click', L.DomEvent.stop)
var filter = L.DomUtil.add('a', 'umap-open-filter-link', container, ' | ' + L._('Filter data')); .on(browser, 'click', this.openBrowser, this);
filter.href = '#'; var filter = L.DomUtil.add('a', 'umap-open-filter-link', container, ' | ' + L._('Filter data'));
L.DomEvent.on(filter, 'click', L.DomEvent.stop) filter.href = '#';
.on(filter, 'click', this.openFilter, this); L.DomEvent.on(filter, 'click', L.DomEvent.stop)
.on(filter, 'click', this.openFilter, this);
}
var setName = function () { var setName = function () {
name.textContent = this.getDisplayName(); name.textContent = this.getDisplayName();
}; };