add shorcuts to geocoder/background tooltips

This commit is contained in:
Ansis Brammanis
2013-03-11 17:12:23 -04:00
parent f1da075982
commit 79ae138a19
2 changed files with 13 additions and 6 deletions

View File

@@ -1,5 +1,6 @@
iD.ui.Background = function(context) {
var event = d3.dispatch('cancel', 'save'),
key = 'b',
opacities = [1, 0.5, 0];
var layers = context.backgroundSources();
@@ -19,12 +20,13 @@ iD.ui.Background = function(context) {
shown = false;
var tooltip = bootstrap.tooltip()
.placement('right');
.placement('right')
.html(true)
.title(iD.ui.tooltipHtml(t('background.description'), key));
var button = selection.append('button')
.attr('tabindex', -1)
.attr('class', 'fillD')
.attr('title', t('background.description'))
.on('click.background-toggle', toggle)
.call(tooltip);
@@ -227,7 +229,7 @@ iD.ui.Background = function(context) {
var keybinding = d3.keybinding('background');
keybinding.on('b', toggle);
keybinding.on(key, toggle);
d3.select(document)
.call(keybinding);

View File

@@ -1,4 +1,7 @@
iD.ui.Geocoder = function(context) {
var key = 'f';
function resultExtent(bounds) {
return new iD.geo.Extent(
[parseFloat(bounds[3]), parseFloat(bounds[0])],
@@ -81,11 +84,13 @@ iD.ui.Geocoder = function(context) {
shown = show;
}
}
var tooltip = bootstrap.tooltip().placement('right');
var tooltip = bootstrap.tooltip()
.placement('right')
.html(true)
.title(iD.ui.tooltipHtml(t('geocoder.title'), key));
var button = selection.append('button')
.attr('tabindex', -1)
.attr('title', t('geocoder.title'))
.on('click', toggle)
.call(tooltip);
@@ -111,7 +116,7 @@ iD.ui.Geocoder = function(context) {
var keybinding = d3.keybinding('geocoder');
keybinding.on('f', toggle);
keybinding.on(key, toggle);
d3.select(document)
.call(keybinding);