From 79ae138a19612c6d43c76ece5fabc9c8a79d78ec Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Mon, 11 Mar 2013 17:12:23 -0400 Subject: [PATCH] add shorcuts to geocoder/background tooltips --- js/id/ui/background.js | 8 +++++--- js/id/ui/geocoder.js | 11 ++++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/js/id/ui/background.js b/js/id/ui/background.js index 6e0718e8e..4d5588567 100644 --- a/js/id/ui/background.js +++ b/js/id/ui/background.js @@ -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); diff --git a/js/id/ui/geocoder.js b/js/id/ui/geocoder.js index 82df826aa..b72b36f23 100644 --- a/js/id/ui/geocoder.js +++ b/js/id/ui/geocoder.js @@ -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);