mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 01:02:58 +00:00
Destroy all old background layer tooltips before making new ones
(closes #5551)
This commit is contained in:
@@ -52,6 +52,8 @@ export function uiBackground(context) {
|
||||
var description = d.description();
|
||||
var isOverflowing = (span.property('clientWidth') !== span.property('scrollWidth'));
|
||||
|
||||
item.call(tooltip().destroyAny);
|
||||
|
||||
if (d === _previousBackground) {
|
||||
item.call(tooltip()
|
||||
.placement(placement)
|
||||
@@ -66,8 +68,6 @@ export function uiBackground(context) {
|
||||
.placement(placement)
|
||||
.title(description || d.name())
|
||||
);
|
||||
} else {
|
||||
item.call(tooltip().destroy);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user