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

@@ -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();