mirror of
https://github.com/FoggedLens/iD.git
synced 2026-04-29 07:06:04 +02:00
Optimize resetting opacity
This commit is contained in:
+12
-2
@@ -212,15 +212,25 @@ iD.svg.Labels = function(projection) {
|
||||
containsLabel = iD.util.trueObj(labels),
|
||||
selection = d3.select(this);
|
||||
|
||||
// ensures that simply resetting opacity
|
||||
// does not force style recalculation
|
||||
function resetOpacity() {
|
||||
if (this._opacity !== '') {
|
||||
this.style.opacity = '';
|
||||
this._opacity = '';
|
||||
}
|
||||
}
|
||||
|
||||
selection.selectAll('.layer-label text, .layer-halo path, .layer-halo rect')
|
||||
.style('opacity', '');
|
||||
.each(resetOpacity);
|
||||
|
||||
if (!labels.length) return;
|
||||
selection.selectAll('.layer-label text, .layer-halo path, .layer-halo rect')
|
||||
.filter(function(d) {
|
||||
return containsLabel[d.id];
|
||||
})
|
||||
.style('opacity', 0);
|
||||
.style('opacity', 0)
|
||||
.property('_opacity', 0);
|
||||
}
|
||||
|
||||
var rtree = new RTree(),
|
||||
|
||||
Reference in New Issue
Block a user