add tooltips to add-field buttons

This commit is contained in:
Ansis Brammanis
2013-03-14 11:46:33 -04:00
parent 23222b62b4
commit d412664d00
2 changed files with 16 additions and 1 deletions

View File

@@ -743,6 +743,15 @@ button.preset-add-field {
margin-right: 10px;
}
.preset-add-field .tooltip.top .tooltip-arrow {
border-top-color: #000;
}
.preset-add-field .tooltip-inner {
background: #000;
color: #DDD;
}
.preset-fav button.fav {
height: 30px;
margin: 5px;

View File

@@ -51,11 +51,17 @@ iD.ui.preset = function(context) {
.enter()
.append('button')
.attr('class', 'preset-add-field')
.attr('title', function(d) { return d.label(); })
.on('click', addForm)
.each(tooltip)
.append('span')
.attr('class', function(d) { return 'icon ' + d.icon; });
function tooltip(d) {
d3.select(this).call(bootstrap.tooltip()
.placement('top')
.title(d.label()));
}
function addForm(d) {
draw(formwrap, [d]);
d3.select(this).remove();