Avoid unecessary style changes in attribution control

This commit is contained in:
Tom Payne
2012-10-03 18:51:33 +02:00
parent d0a330c870
commit a95e9b9c8b
+7 -2
View File
@@ -143,7 +143,9 @@ ol.control.Attribution.prototype.createAttributionElementsForLayer_ =
!layerVisible || !layerVisible ||
goog.isNull(attributionVisibilities) || goog.isNull(attributionVisibilities) ||
!attributionVisibilities[attributionKey]) { !attributionVisibilities[attributionKey]) {
goog.style.showElement(attributionElement, false); if (goog.style.isElementShown(attributionElement)) {
goog.style.showElement(attributionElement, false);
}
} }
goog.dom.appendChild(this.ulElement_, attributionElement); goog.dom.appendChild(this.ulElement_, attributionElement);
@@ -400,7 +402,10 @@ ol.control.Attribution.prototype.updateLayerAttributionsVisibility_ =
attributionVisibilities, attributionVisibilities,
function(attributionVisible, attributionKey) { function(attributionVisible, attributionKey) {
var attributionElement = this.attributionElements_[attributionKey]; var attributionElement = this.attributionElements_[attributionKey];
goog.style.showElement(attributionElement, attributionVisible); if (goog.style.isElementShown(attributionElement) !=
attributionVisible) {
goog.style.showElement(attributionElement, attributionVisible);
}
}, },
this); this);
} else { } else {