Remove goog.style.setElementShown

This commit is contained in:
nicholas
2016-03-25 18:03:04 +13:00
committed by Nicholas L
parent 96a14e0515
commit 04c4b4efc1
7 changed files with 19 additions and 27 deletions

View File

@@ -4,7 +4,6 @@ goog.provide('ol.control.Attribution');
goog.require('goog.asserts');
goog.require('goog.dom');
goog.require('goog.style');
goog.require('ol');
goog.require('ol.Attribution');
goog.require('ol.control.Control');
@@ -44,7 +43,7 @@ ol.control.Attribution = function(opt_options) {
this.logoLi_ = document.createElement('LI');
this.ulElement_.appendChild(this.logoLi_);
goog.style.setElementShown(this.logoLi_, false);
this.logoLi_.style.display = 'none'; // Hide the logo
/**
* @private
@@ -214,7 +213,7 @@ ol.control.Attribution.prototype.updateElement_ = function(frameState) {
if (!frameState) {
if (this.renderedVisible_) {
goog.style.setElementShown(this.element, false);
this.element.style.display = 'none'; //Hide the element
this.renderedVisible_ = false;
}
return;
@@ -230,15 +229,13 @@ ol.control.Attribution.prototype.updateElement_ = function(frameState) {
for (attributionKey in this.attributionElements_) {
if (attributionKey in visibleAttributions) {
if (!this.attributionElementRenderedVisible_[attributionKey]) {
goog.style.setElementShown(
this.attributionElements_[attributionKey], true);
this.attributionElements_[attributionKey].style.display = ''; // Show the element
this.attributionElementRenderedVisible_[attributionKey] = true;
}
delete visibleAttributions[attributionKey];
} else if (attributionKey in hiddenAttributions) {
if (this.attributionElementRenderedVisible_[attributionKey]) {
goog.style.setElementShown(
this.attributionElements_[attributionKey], false);
this.attributionElements_[attributionKey].style.display = 'none'; //Hide the element
delete this.attributionElementRenderedVisible_[attributionKey];
}
delete hiddenAttributions[attributionKey];
@@ -260,7 +257,7 @@ ol.control.Attribution.prototype.updateElement_ = function(frameState) {
attributionElement = document.createElement('LI');
attributionElement.innerHTML =
hiddenAttributions[attributionKey].getHTML();
goog.style.setElementShown(attributionElement, false);
attributionElement.style.display = 'none'; //Hide the element
this.ulElement_.appendChild(attributionElement);
this.attributionElements_[attributionKey] = attributionElement;
}
@@ -269,7 +266,7 @@ ol.control.Attribution.prototype.updateElement_ = function(frameState) {
!ol.object.isEmpty(this.attributionElementRenderedVisible_) ||
!ol.object.isEmpty(frameState.logos);
if (this.renderedVisible_ != renderVisible) {
goog.style.setElementShown(this.element, renderVisible);
this.element.style.display = renderVisible ? '' : 'none'; //Conditionally hide
this.renderedVisible_ = renderVisible;
}
if (renderVisible &&
@@ -324,7 +321,7 @@ ol.control.Attribution.prototype.insertLogos_ = function(frameState) {
}
}
goog.style.setElementShown(this.logoLi_, !ol.object.isEmpty(logos));
this.logoLi_.style.display = !ol.object.isEmpty(logos) ? '' : 'none';
};

View File

@@ -4,7 +4,6 @@ goog.provide('ol.control.ScaleLineUnits');
goog.require('goog.asserts');
goog.require('ol.events');
goog.require('goog.style');
goog.require('ol');
goog.require('ol.Object');
goog.require('ol.control.Control');
@@ -183,7 +182,7 @@ ol.control.ScaleLine.prototype.updateElement_ = function() {
if (!viewState) {
if (this.renderedVisible_) {
goog.style.setElementShown(this.element_, false);
this.element_.style.display = 'none';
this.renderedVisible_ = false;
}
return;
@@ -258,7 +257,7 @@ ol.control.ScaleLine.prototype.updateElement_ = function() {
Math.pow(10, Math.floor(i / 3));
width = Math.round(count / pointResolution);
if (isNaN(width)) {
goog.style.setElementShown(this.element_, false);
this.element_.style.display = 'none'; // Hide the element
this.renderedVisible_ = false;
return;
} else if (width >= this.minWidth_) {
@@ -279,7 +278,7 @@ ol.control.ScaleLine.prototype.updateElement_ = function() {
}
if (!this.renderedVisible_) {
goog.style.setElementShown(this.element_, true);
this.element_.style.display = ''; //Show the element
this.renderedVisible_ = true;
}

View File

@@ -469,7 +469,7 @@ ol.Overlay.prototype.setPositioning = function(positioning) {
*/
ol.Overlay.prototype.setVisible = function(visible) {
if (this.rendered_.visible !== visible) {
goog.style.setElementShown(this.element_, visible);
this.element_.style.display = visible ? '' : 'none';
this.rendered_.visible = visible;
}
};

View File

@@ -4,7 +4,6 @@ goog.provide('ol.renderer.canvas.Map');
goog.require('goog.asserts');
goog.require('goog.dom');
goog.require('goog.style');
goog.require('goog.vec.Mat4');
goog.require('ol');
goog.require('ol.RendererType');
@@ -149,7 +148,7 @@ ol.renderer.canvas.Map.prototype.renderFrame = function(frameState) {
if (!frameState) {
if (this.renderedVisible_) {
goog.style.setElementShown(this.canvas_, false);
this.canvas_.style.display = 'none'; //Hide the element
this.renderedVisible_ = false;
}
return;
@@ -200,7 +199,7 @@ ol.renderer.canvas.Map.prototype.renderFrame = function(frameState) {
ol.render.EventType.POSTCOMPOSE, frameState);
if (!this.renderedVisible_) {
goog.style.setElementShown(this.canvas_, true);
this.canvas_.style.display = ''; //Show the element
this.renderedVisible_ = true;
}

View File

@@ -5,7 +5,6 @@ goog.require('goog.dom');
goog.require('ol.events');
goog.require('ol.events.Event');
goog.require('ol.events.EventType');
goog.require('goog.style');
goog.require('goog.vec.Mat4');
goog.require('ol');
goog.require('ol.RendererType');
@@ -157,7 +156,7 @@ ol.renderer.dom.Map.prototype.renderFrame = function(frameState) {
if (!frameState) {
if (this.renderedVisible_) {
goog.style.setElementShown(this.layersPane_, false);
this.layersPane_.style.display = 'none'; //Hide the element
this.renderedVisible_ = false;
}
return;
@@ -209,7 +208,7 @@ ol.renderer.dom.Map.prototype.renderFrame = function(frameState) {
}
if (!this.renderedVisible_) {
goog.style.setElementShown(this.layersPane_, true);
this.layersPane_.style.display = ''; //Show the element
this.renderedVisible_ = true;
}

View File

@@ -5,7 +5,6 @@ goog.provide('ol.renderer.dom.TileLayer');
goog.require('goog.asserts');
goog.require('goog.dom');
goog.require('goog.style');
goog.require('goog.vec.Mat4');
goog.require('ol');
goog.require('ol.TileRange');
@@ -77,7 +76,7 @@ ol.renderer.dom.TileLayer.prototype.prepareFrame = function(frameState, layerSta
if (!layerState.visible) {
if (this.renderedVisible_) {
goog.style.setElementShown(this.target, false);
this.target.style.display = 'none'; //Hide the element
this.renderedVisible_ = false;
}
return true;
@@ -246,7 +245,7 @@ ol.renderer.dom.TileLayer.prototype.prepareFrame = function(frameState, layerSta
}
if (layerState.visible && !this.renderedVisible_) {
goog.style.setElementShown(this.target, true);
this.target.style.display = ''; //Show the element
this.renderedVisible_ = true;
}

View File

@@ -4,7 +4,6 @@ goog.provide('ol.renderer.webgl.Map');
goog.require('goog.asserts');
goog.require('goog.dom');
goog.require('goog.style');
goog.require('goog.webgl');
goog.require('ol');
goog.require('ol.RendererType');
@@ -430,7 +429,7 @@ ol.renderer.webgl.Map.prototype.renderFrame = function(frameState) {
if (!frameState) {
if (this.renderedVisible_) {
goog.style.setElementShown(this.canvas_, false);
this.canvas_.style.display = 'none'; //Hide the element
this.renderedVisible_ = false;
}
return false;
@@ -486,7 +485,7 @@ ol.renderer.webgl.Map.prototype.renderFrame = function(frameState) {
}
if (!this.renderedVisible_) {
goog.style.setElementShown(this.canvas_, true);
this.canvas_.style.display = ''; //Show the element
this.renderedVisible_ = true;
}