Destroy all old background layer tooltips before making new ones

(closes #5551)
This commit is contained in:
Bryan Housel
2018-12-05 00:35:45 -05:00
parent 4bfc78c69b
commit bee01d8497
2 changed files with 12 additions and 4 deletions
+10 -2
View File
@@ -69,7 +69,10 @@ export function tooltip() {
};
tooltip.destroy = function(selection) {
tooltip.destroy = function(selection, selector) {
// by default, just destroy the current tooltip
selector = selector || '.tooltip-' + _id;
selection
.on('mouseenter.tooltip', null)
.on('mouseleave.tooltip', null)
@@ -77,11 +80,16 @@ export function tooltip() {
return this.getAttribute('data-original-title') || this.getAttribute('title');
})
.attr('data-original-title', null)
.selectAll('.tooltip-' + _id)
.selectAll(selector)
.remove();
};
tooltip.destroyAny = function(selection) {
selection.call(tooltip.destroy, '.tooltip');
};
function setup() {
var root = d3_select(this);
var animate = _animation.apply(this, arguments);