Add button to toggle the Background info panel (re: #6397)

Reword imagery problem link label (close #6820)
This commit is contained in:
Quincy Morgan
2019-09-09 12:23:58 -04:00
parent e1b512aee5
commit 46a52cb19e
5 changed files with 52 additions and 15 deletions
+29 -6
View File
@@ -198,15 +198,15 @@ export function uiBackground(context) {
// add minimap toggle below list
var minimapEnter = selection.selectAll('.minimap-toggle-list')
var bgExtrasListEnter = selection.selectAll('.bg-extras-list')
.data([0])
.enter()
.append('ul')
.attr('class', 'layer-list minimap-toggle-list')
.append('li')
.attr('class', 'minimap-toggle-item');
.attr('class', 'layer-list bg-extras-list');
var minimapLabelEnter = minimapEnter
var minimapLabelEnter = bgExtrasListEnter
.append('li')
.attr('class', 'minimap-toggle-item')
.append('label')
.call(tooltip()
.html(true)
@@ -227,6 +227,29 @@ export function uiBackground(context) {
.text(t('background.minimap.description'));
var panelLabelEnter = bgExtrasListEnter
.append('li')
.attr('class', 'background-panel-toggle-item')
.append('label')
.call(tooltip()
.html(true)
.title(uiTooltipHtml(t('background.panel.tooltip'), uiCmd('⌘⇧' + t('info_panels.background.key'))))
.placement('top')
);
panelLabelEnter
.append('input')
.attr('type', 'checkbox')
.on('change', function() {
d3_event.preventDefault();
context.ui().info.toggle('background');
});
panelLabelEnter
.append('span')
.text(t('background.panel.description'));
// "Info / Report a Problem" link
selection.selectAll('.imagery-faq')
.data([0])
@@ -238,7 +261,7 @@ export function uiBackground(context) {
.call(svgIcon('#iD-icon-out-link', 'inline'))
.attr('href', 'https://github.com/openstreetmap/iD/blob/master/FAQ.md#how-can-i-report-an-issue-with-background-imagery')
.append('span')
.text(t('background.imagery_source_faq'));
.text(t('background.imagery_problem_faq'));
updateBackgroundList();
}
+11 -5
View File
@@ -64,7 +64,7 @@ export function uiInfo(context) {
title
.append('button')
.attr('class', 'close')
.on('click', function (d) { toggle(d); })
.on('click', function (d) { info.toggle(d); })
.call(svgIcon('#iD-icon-close'));
enter
@@ -80,7 +80,7 @@ export function uiInfo(context) {
}
function toggle(which) {
info.toggle = function(which) {
if (d3_event) {
d3_event.stopImmediatePropagation();
d3_event.preventDefault();
@@ -93,6 +93,12 @@ export function uiInfo(context) {
if (activeids.length === 1 && activeids[0] === which) { // none active anymore
wasActive = [which];
}
d3_select('.' + which + '-panel-toggle-item')
.classed('active', active[which])
.select('input')
.property('checked', active[which]);
} else { // toggle all
if (activeids.length) {
wasActive = activeids;
@@ -103,7 +109,7 @@ export function uiInfo(context) {
}
redraw();
}
};
var infoPanels = selection.selectAll('.info-panels')
@@ -117,13 +123,13 @@ export function uiInfo(context) {
redraw();
context.keybinding()
.on(uiCmd('⌘' + t('info_panels.key')), toggle);
.on(uiCmd('⌘' + t('info_panels.key')), info.toggle);
ids.forEach(function(k) {
var key = t('info_panels.' + k + '.key', { default: null });
if (!key) return;
context.keybinding()
.on(uiCmd('⌘⇧' + key), function() { toggle(k); });
.on(uiCmd('⌘⇧' + key), function() { info.toggle(k); });
});
}
+3 -2
View File
@@ -242,11 +242,13 @@ export function uiInit(context) {
.call(issues.renderPane)
.call(help.renderPane);
ui.info = uiInfo(context);
// Add absolutely-positioned elements that sit on top of the map
// This should happen after the map is ready (center/zoom)
overMap
.call(uiMapInMap(context))
.call(uiInfo(context))
.call(ui.info)
.call(uiNotice(context));
@@ -362,7 +364,6 @@ export function uiInit(context) {
});
};
ui.sidebar = uiSidebar(context);
ui.photoviewer = uiPhotoviewer(context);