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
+7 -10
View File
@@ -4,7 +4,6 @@ goog.provide('ol.control.Attribution');
goog.require('goog.asserts'); goog.require('goog.asserts');
goog.require('goog.dom'); goog.require('goog.dom');
goog.require('goog.style');
goog.require('ol'); goog.require('ol');
goog.require('ol.Attribution'); goog.require('ol.Attribution');
goog.require('ol.control.Control'); goog.require('ol.control.Control');
@@ -44,7 +43,7 @@ ol.control.Attribution = function(opt_options) {
this.logoLi_ = document.createElement('LI'); this.logoLi_ = document.createElement('LI');
this.ulElement_.appendChild(this.logoLi_); this.ulElement_.appendChild(this.logoLi_);
goog.style.setElementShown(this.logoLi_, false); this.logoLi_.style.display = 'none'; // Hide the logo
/** /**
* @private * @private
@@ -214,7 +213,7 @@ ol.control.Attribution.prototype.updateElement_ = function(frameState) {
if (!frameState) { if (!frameState) {
if (this.renderedVisible_) { if (this.renderedVisible_) {
goog.style.setElementShown(this.element, false); this.element.style.display = 'none'; //Hide the element
this.renderedVisible_ = false; this.renderedVisible_ = false;
} }
return; return;
@@ -230,15 +229,13 @@ ol.control.Attribution.prototype.updateElement_ = function(frameState) {
for (attributionKey in this.attributionElements_) { for (attributionKey in this.attributionElements_) {
if (attributionKey in visibleAttributions) { if (attributionKey in visibleAttributions) {
if (!this.attributionElementRenderedVisible_[attributionKey]) { if (!this.attributionElementRenderedVisible_[attributionKey]) {
goog.style.setElementShown( this.attributionElements_[attributionKey].style.display = ''; // Show the element
this.attributionElements_[attributionKey], true);
this.attributionElementRenderedVisible_[attributionKey] = true; this.attributionElementRenderedVisible_[attributionKey] = true;
} }
delete visibleAttributions[attributionKey]; delete visibleAttributions[attributionKey];
} else if (attributionKey in hiddenAttributions) { } else if (attributionKey in hiddenAttributions) {
if (this.attributionElementRenderedVisible_[attributionKey]) { if (this.attributionElementRenderedVisible_[attributionKey]) {
goog.style.setElementShown( this.attributionElements_[attributionKey].style.display = 'none'; //Hide the element
this.attributionElements_[attributionKey], false);
delete this.attributionElementRenderedVisible_[attributionKey]; delete this.attributionElementRenderedVisible_[attributionKey];
} }
delete hiddenAttributions[attributionKey]; delete hiddenAttributions[attributionKey];
@@ -260,7 +257,7 @@ ol.control.Attribution.prototype.updateElement_ = function(frameState) {
attributionElement = document.createElement('LI'); attributionElement = document.createElement('LI');
attributionElement.innerHTML = attributionElement.innerHTML =
hiddenAttributions[attributionKey].getHTML(); hiddenAttributions[attributionKey].getHTML();
goog.style.setElementShown(attributionElement, false); attributionElement.style.display = 'none'; //Hide the element
this.ulElement_.appendChild(attributionElement); this.ulElement_.appendChild(attributionElement);
this.attributionElements_[attributionKey] = attributionElement; this.attributionElements_[attributionKey] = attributionElement;
} }
@@ -269,7 +266,7 @@ ol.control.Attribution.prototype.updateElement_ = function(frameState) {
!ol.object.isEmpty(this.attributionElementRenderedVisible_) || !ol.object.isEmpty(this.attributionElementRenderedVisible_) ||
!ol.object.isEmpty(frameState.logos); !ol.object.isEmpty(frameState.logos);
if (this.renderedVisible_ != renderVisible) { if (this.renderedVisible_ != renderVisible) {
goog.style.setElementShown(this.element, renderVisible); this.element.style.display = renderVisible ? '' : 'none'; //Conditionally hide
this.renderedVisible_ = renderVisible; this.renderedVisible_ = renderVisible;
} }
if (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';
}; };
+3 -4
View File
@@ -4,7 +4,6 @@ goog.provide('ol.control.ScaleLineUnits');
goog.require('goog.asserts'); goog.require('goog.asserts');
goog.require('ol.events'); goog.require('ol.events');
goog.require('goog.style');
goog.require('ol'); goog.require('ol');
goog.require('ol.Object'); goog.require('ol.Object');
goog.require('ol.control.Control'); goog.require('ol.control.Control');
@@ -183,7 +182,7 @@ ol.control.ScaleLine.prototype.updateElement_ = function() {
if (!viewState) { if (!viewState) {
if (this.renderedVisible_) { if (this.renderedVisible_) {
goog.style.setElementShown(this.element_, false); this.element_.style.display = 'none';
this.renderedVisible_ = false; this.renderedVisible_ = false;
} }
return; return;
@@ -258,7 +257,7 @@ ol.control.ScaleLine.prototype.updateElement_ = function() {
Math.pow(10, Math.floor(i / 3)); Math.pow(10, Math.floor(i / 3));
width = Math.round(count / pointResolution); width = Math.round(count / pointResolution);
if (isNaN(width)) { if (isNaN(width)) {
goog.style.setElementShown(this.element_, false); this.element_.style.display = 'none'; // Hide the element
this.renderedVisible_ = false; this.renderedVisible_ = false;
return; return;
} else if (width >= this.minWidth_) { } else if (width >= this.minWidth_) {
@@ -279,7 +278,7 @@ ol.control.ScaleLine.prototype.updateElement_ = function() {
} }
if (!this.renderedVisible_) { if (!this.renderedVisible_) {
goog.style.setElementShown(this.element_, true); this.element_.style.display = ''; //Show the element
this.renderedVisible_ = true; this.renderedVisible_ = true;
} }
+1 -1
View File
@@ -469,7 +469,7 @@ ol.Overlay.prototype.setPositioning = function(positioning) {
*/ */
ol.Overlay.prototype.setVisible = function(visible) { ol.Overlay.prototype.setVisible = function(visible) {
if (this.rendered_.visible !== visible) { if (this.rendered_.visible !== visible) {
goog.style.setElementShown(this.element_, visible); this.element_.style.display = visible ? '' : 'none';
this.rendered_.visible = visible; this.rendered_.visible = visible;
} }
}; };
+2 -3
View File
@@ -4,7 +4,6 @@ goog.provide('ol.renderer.canvas.Map');
goog.require('goog.asserts'); goog.require('goog.asserts');
goog.require('goog.dom'); goog.require('goog.dom');
goog.require('goog.style');
goog.require('goog.vec.Mat4'); goog.require('goog.vec.Mat4');
goog.require('ol'); goog.require('ol');
goog.require('ol.RendererType'); goog.require('ol.RendererType');
@@ -149,7 +148,7 @@ ol.renderer.canvas.Map.prototype.renderFrame = function(frameState) {
if (!frameState) { if (!frameState) {
if (this.renderedVisible_) { if (this.renderedVisible_) {
goog.style.setElementShown(this.canvas_, false); this.canvas_.style.display = 'none'; //Hide the element
this.renderedVisible_ = false; this.renderedVisible_ = false;
} }
return; return;
@@ -200,7 +199,7 @@ ol.renderer.canvas.Map.prototype.renderFrame = function(frameState) {
ol.render.EventType.POSTCOMPOSE, frameState); ol.render.EventType.POSTCOMPOSE, frameState);
if (!this.renderedVisible_) { if (!this.renderedVisible_) {
goog.style.setElementShown(this.canvas_, true); this.canvas_.style.display = ''; //Show the element
this.renderedVisible_ = true; this.renderedVisible_ = true;
} }
+2 -3
View File
@@ -5,7 +5,6 @@ goog.require('goog.dom');
goog.require('ol.events'); goog.require('ol.events');
goog.require('ol.events.Event'); goog.require('ol.events.Event');
goog.require('ol.events.EventType'); goog.require('ol.events.EventType');
goog.require('goog.style');
goog.require('goog.vec.Mat4'); goog.require('goog.vec.Mat4');
goog.require('ol'); goog.require('ol');
goog.require('ol.RendererType'); goog.require('ol.RendererType');
@@ -157,7 +156,7 @@ ol.renderer.dom.Map.prototype.renderFrame = function(frameState) {
if (!frameState) { if (!frameState) {
if (this.renderedVisible_) { if (this.renderedVisible_) {
goog.style.setElementShown(this.layersPane_, false); this.layersPane_.style.display = 'none'; //Hide the element
this.renderedVisible_ = false; this.renderedVisible_ = false;
} }
return; return;
@@ -209,7 +208,7 @@ ol.renderer.dom.Map.prototype.renderFrame = function(frameState) {
} }
if (!this.renderedVisible_) { if (!this.renderedVisible_) {
goog.style.setElementShown(this.layersPane_, true); this.layersPane_.style.display = ''; //Show the element
this.renderedVisible_ = true; this.renderedVisible_ = true;
} }
+2 -3
View File
@@ -5,7 +5,6 @@ goog.provide('ol.renderer.dom.TileLayer');
goog.require('goog.asserts'); goog.require('goog.asserts');
goog.require('goog.dom'); goog.require('goog.dom');
goog.require('goog.style');
goog.require('goog.vec.Mat4'); goog.require('goog.vec.Mat4');
goog.require('ol'); goog.require('ol');
goog.require('ol.TileRange'); goog.require('ol.TileRange');
@@ -77,7 +76,7 @@ ol.renderer.dom.TileLayer.prototype.prepareFrame = function(frameState, layerSta
if (!layerState.visible) { if (!layerState.visible) {
if (this.renderedVisible_) { if (this.renderedVisible_) {
goog.style.setElementShown(this.target, false); this.target.style.display = 'none'; //Hide the element
this.renderedVisible_ = false; this.renderedVisible_ = false;
} }
return true; return true;
@@ -246,7 +245,7 @@ ol.renderer.dom.TileLayer.prototype.prepareFrame = function(frameState, layerSta
} }
if (layerState.visible && !this.renderedVisible_) { if (layerState.visible && !this.renderedVisible_) {
goog.style.setElementShown(this.target, true); this.target.style.display = ''; //Show the element
this.renderedVisible_ = true; this.renderedVisible_ = true;
} }
+2 -3
View File
@@ -4,7 +4,6 @@ goog.provide('ol.renderer.webgl.Map');
goog.require('goog.asserts'); goog.require('goog.asserts');
goog.require('goog.dom'); goog.require('goog.dom');
goog.require('goog.style');
goog.require('goog.webgl'); goog.require('goog.webgl');
goog.require('ol'); goog.require('ol');
goog.require('ol.RendererType'); goog.require('ol.RendererType');
@@ -430,7 +429,7 @@ ol.renderer.webgl.Map.prototype.renderFrame = function(frameState) {
if (!frameState) { if (!frameState) {
if (this.renderedVisible_) { if (this.renderedVisible_) {
goog.style.setElementShown(this.canvas_, false); this.canvas_.style.display = 'none'; //Hide the element
this.renderedVisible_ = false; this.renderedVisible_ = false;
} }
return false; return false;
@@ -486,7 +485,7 @@ ol.renderer.webgl.Map.prototype.renderFrame = function(frameState) {
} }
if (!this.renderedVisible_) { if (!this.renderedVisible_) {
goog.style.setElementShown(this.canvas_, true); this.canvas_.style.display = ''; //Show the element
this.renderedVisible_ = true; this.renderedVisible_ = true;
} }