Merge pull request #5125 from nicholas-l/removeGoogStyle
Remove goog style
This commit is contained in:
@@ -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';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @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';
|
||||||
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 = '';
|
||||||
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';
|
||||||
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';
|
||||||
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';
|
||||||
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';
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -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';
|
||||||
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 = '';
|
||||||
this.renderedVisible_ = true;
|
this.renderedVisible_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ goog.provide('ol.control.ZoomSlider');
|
|||||||
|
|
||||||
goog.require('goog.asserts');
|
goog.require('goog.asserts');
|
||||||
goog.require('goog.dom');
|
goog.require('goog.dom');
|
||||||
goog.require('goog.style');
|
|
||||||
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');
|
||||||
@@ -185,15 +184,18 @@ ol.control.ZoomSlider.prototype.setMap = function(map) {
|
|||||||
*/
|
*/
|
||||||
ol.control.ZoomSlider.prototype.initSlider_ = function() {
|
ol.control.ZoomSlider.prototype.initSlider_ = function() {
|
||||||
var container = this.element;
|
var container = this.element;
|
||||||
var containerSize = goog.style.getSize(container);
|
var containerSize = {
|
||||||
|
width: container.offsetWidth, height: container.offsetHeight
|
||||||
|
};
|
||||||
|
|
||||||
var thumb = container.firstElementChild;
|
var thumb = container.firstElementChild;
|
||||||
var thumbMargins = goog.style.getMarginBox(thumb);
|
var computedStyle = ol.global.getComputedStyle(thumb);
|
||||||
var thumbBorderBoxSize = goog.style.getBorderBoxSize(thumb);
|
var thumbWidth = thumb.offsetWidth +
|
||||||
var thumbWidth = thumbBorderBoxSize.width +
|
parseFloat(computedStyle['marginRight']) +
|
||||||
thumbMargins.right + thumbMargins.left;
|
parseFloat(computedStyle['marginLeft']);
|
||||||
var thumbHeight = thumbBorderBoxSize.height +
|
var thumbHeight = thumb.offsetHeight +
|
||||||
thumbMargins.top + thumbMargins.bottom;
|
parseFloat(computedStyle['marginTop']) +
|
||||||
|
parseFloat(computedStyle['marginBottom']);
|
||||||
this.thumbSize_ = [thumbWidth, thumbHeight];
|
this.thumbSize_ = [thumbWidth, thumbHeight];
|
||||||
|
|
||||||
if (containerSize.width > containerSize.height) {
|
if (containerSize.width > containerSize.height) {
|
||||||
|
|||||||
+13
-3
@@ -8,7 +8,6 @@ goog.provide('ol.MapProperty');
|
|||||||
goog.require('goog.asserts');
|
goog.require('goog.asserts');
|
||||||
goog.require('goog.async.nextTick');
|
goog.require('goog.async.nextTick');
|
||||||
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.Collection');
|
goog.require('ol.Collection');
|
||||||
goog.require('ol.CollectionEventType');
|
goog.require('ol.CollectionEventType');
|
||||||
@@ -1426,8 +1425,19 @@ ol.Map.prototype.updateSize = function() {
|
|||||||
if (!targetElement) {
|
if (!targetElement) {
|
||||||
this.setSize(undefined);
|
this.setSize(undefined);
|
||||||
} else {
|
} else {
|
||||||
var size = goog.style.getContentBoxSize(targetElement);
|
var computedStyle = ol.global.getComputedStyle(targetElement);
|
||||||
this.setSize([size.width, size.height]);
|
this.setSize([
|
||||||
|
targetElement.offsetWidth -
|
||||||
|
parseFloat(computedStyle['borderLeftWidth']) -
|
||||||
|
parseFloat(computedStyle['paddingLeft']) -
|
||||||
|
parseFloat(computedStyle['paddingRight']) -
|
||||||
|
parseFloat(computedStyle['borderRightWidth']),
|
||||||
|
targetElement.offsetHeight -
|
||||||
|
parseFloat(computedStyle['borderTopWidth']) -
|
||||||
|
parseFloat(computedStyle['paddingTop']) -
|
||||||
|
parseFloat(computedStyle['paddingBottom']) -
|
||||||
|
parseFloat(computedStyle['borderBottomWidth'])
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+10
-9
@@ -5,7 +5,6 @@ goog.provide('ol.OverlayProperty');
|
|||||||
goog.require('goog.asserts');
|
goog.require('goog.asserts');
|
||||||
goog.require('goog.dom');
|
goog.require('goog.dom');
|
||||||
goog.require('ol.events');
|
goog.require('ol.events');
|
||||||
goog.require('goog.style');
|
|
||||||
goog.require('ol.Map');
|
goog.require('ol.Map');
|
||||||
goog.require('ol.MapEventType');
|
goog.require('ol.MapEventType');
|
||||||
goog.require('ol.Object');
|
goog.require('ol.Object');
|
||||||
@@ -440,12 +439,14 @@ ol.Overlay.prototype.getRect_ = function(element, size) {
|
|||||||
goog.asserts.assert(element, 'element should be defined');
|
goog.asserts.assert(element, 'element should be defined');
|
||||||
goog.asserts.assert(size !== undefined, 'size should be defined');
|
goog.asserts.assert(size !== undefined, 'size should be defined');
|
||||||
|
|
||||||
var offset = goog.style.getPageOffset(element);
|
var box = element.getBoundingClientRect();
|
||||||
|
var offsetX = box.left + ol.global.pageXOffset;
|
||||||
|
var offsetY = box.top + ol.global.pageYOffset;
|
||||||
return [
|
return [
|
||||||
offset.x,
|
offsetX,
|
||||||
offset.y,
|
offsetY,
|
||||||
offset.x + size[0],
|
offsetX + size[0],
|
||||||
offset.y + size[1]
|
offsetY + size[1]
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -469,7 +470,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;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -528,7 +529,7 @@ ol.Overlay.prototype.updateRenderedPosition = function(pixel, mapSize) {
|
|||||||
if (positioning == ol.OverlayPositioning.BOTTOM_CENTER ||
|
if (positioning == ol.OverlayPositioning.BOTTOM_CENTER ||
|
||||||
positioning == ol.OverlayPositioning.CENTER_CENTER ||
|
positioning == ol.OverlayPositioning.CENTER_CENTER ||
|
||||||
positioning == ol.OverlayPositioning.TOP_CENTER) {
|
positioning == ol.OverlayPositioning.TOP_CENTER) {
|
||||||
offsetX -= goog.style.getSize(this.element_).width / 2;
|
offsetX -= this.element_.offsetWidth / 2;
|
||||||
}
|
}
|
||||||
var left = Math.round(pixel[0] + offsetX) + 'px';
|
var left = Math.round(pixel[0] + offsetX) + 'px';
|
||||||
if (this.rendered_.left_ != left) {
|
if (this.rendered_.left_ != left) {
|
||||||
@@ -552,7 +553,7 @@ ol.Overlay.prototype.updateRenderedPosition = function(pixel, mapSize) {
|
|||||||
if (positioning == ol.OverlayPositioning.CENTER_LEFT ||
|
if (positioning == ol.OverlayPositioning.CENTER_LEFT ||
|
||||||
positioning == ol.OverlayPositioning.CENTER_CENTER ||
|
positioning == ol.OverlayPositioning.CENTER_CENTER ||
|
||||||
positioning == ol.OverlayPositioning.CENTER_RIGHT) {
|
positioning == ol.OverlayPositioning.CENTER_RIGHT) {
|
||||||
offsetY -= goog.style.getSize(this.element_).height / 2;
|
offsetY -= this.element_.offsetHeight / 2;
|
||||||
}
|
}
|
||||||
var top = Math.round(pixel[1] + offsetY) + 'px';
|
var top = Math.round(pixel[1] + offsetY) + 'px';
|
||||||
if (this.rendered_.top_ != top) {
|
if (this.rendered_.top_ != top) {
|
||||||
|
|||||||
@@ -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';
|
||||||
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 = '';
|
||||||
this.renderedVisible_ = true;
|
this.renderedVisible_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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';
|
||||||
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 = '';
|
||||||
this.renderedVisible_ = true;
|
this.renderedVisible_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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';
|
||||||
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 = '';
|
||||||
this.renderedVisible_ = true;
|
this.renderedVisible_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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';
|
||||||
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 = '';
|
||||||
this.renderedVisible_ = true;
|
this.renderedVisible_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user