Add tooltips to action buttons

This commit is contained in:
Tom MacWright
2012-12-05 16:13:09 -05:00
parent 8126189e0a
commit bf29581ae1
6 changed files with 12 additions and 4 deletions

View File

@@ -350,6 +350,9 @@ div.typeahead a.active {
-webkit-touch-callout:none;
}
#bar button .tooltip {
white-space: normal;
}
.tooltip {
position: absolute;
z-index: 1030;

View File

@@ -33,6 +33,8 @@ window.iD = function(container) {
.enter().append('button')
.attr('class', 'add-button')
.text(function (mode) { return mode.title; })
.attr('data-original-title', function (mode) { return mode.description; })
.call(bootstrap.tooltip().placement('bottom'))
.on('click', function (mode) { controller.enter(mode); });
controller.on('enter', function (entered) {

View File

@@ -1,7 +1,8 @@
iD.modes.AddArea = function() {
var mode = {
id: 'add-area',
title: '+ Area'
title: '+ Area',
description: 'Add parks, buildings, lakes, or other areas to the map.'
};
mode.enter = function() {

View File

@@ -1,7 +1,8 @@
iD.modes.AddPlace = function() {
var mode = {
id: 'add-place',
title: '+ Place'
title: '+ Place',
description: 'Restaurants, monuments, and postal boxes are points.'
};
mode.enter = function() {

View File

@@ -1,7 +1,8 @@
iD.modes.AddRoad = function() {
var mode = {
id: 'add-road',
title: '+ Road'
title: '+ Road',
description: 'Roads can be highways, streets, pedestrian paths, or even canals'
};
mode.enter = function() {

View File

@@ -125,7 +125,7 @@
pos = {x: outer.x - inner.w, y: outer.y + (outer.h - inner.h) / 2};
break;
case "bottom":
pos = {x: outer.x + (outer.w - inner.w) / 2, y: outer.y + outer.h};
pos = {x: Math.max(0, outer.x + (outer.w - inner.w) / 2), y: outer.y + outer.h};
break;
}