Merge pull request #5000 from fredj/rm_goog.style.setBorderBoxSize

Remove use of goog.math.Size and goog.style.setBorderBoxSize
This commit is contained in:
Frédéric Junod
2016-03-14 08:53:32 +01:00

View File

@@ -5,8 +5,6 @@ goog.require('goog.dom');
goog.require('goog.dom.classlist');
goog.require('ol.events');
goog.require('ol.events.EventType');
goog.require('goog.math.Size');
goog.require('goog.style');
goog.require('ol');
goog.require('ol.Collection');
goog.require('ol.Map');
@@ -111,7 +109,9 @@ ol.control.OverviewMap = function(opt_options) {
}, this);
}
var box = goog.dom.createDom('DIV', 'ol-overviewmap-box');
var box = document.createElement('DIV');
box.className = 'ol-overviewmap-box';
box.style.boxSizing = 'border-box';
/**
* @type {ol.Overlay}
@@ -282,17 +282,17 @@ ol.control.OverviewMap.prototype.validateExtent_ = function() {
ovmap.getPixelFromCoordinate(ol.extent.getTopLeft(extent));
var bottomRightPixel =
ovmap.getPixelFromCoordinate(ol.extent.getBottomRight(extent));
var boxSize = new goog.math.Size(
Math.abs(topLeftPixel[0] - bottomRightPixel[0]),
Math.abs(topLeftPixel[1] - bottomRightPixel[1]));
var boxWidth = Math.abs(topLeftPixel[0] - bottomRightPixel[0]);
var boxHeight = Math.abs(topLeftPixel[1] - bottomRightPixel[1]);
var ovmapWidth = ovmapSize[0];
var ovmapHeight = ovmapSize[1];
if (boxSize.width < ovmapWidth * ol.OVERVIEWMAP_MIN_RATIO ||
boxSize.height < ovmapHeight * ol.OVERVIEWMAP_MIN_RATIO ||
boxSize.width > ovmapWidth * ol.OVERVIEWMAP_MAX_RATIO ||
boxSize.height > ovmapHeight * ol.OVERVIEWMAP_MAX_RATIO) {
if (boxWidth < ovmapWidth * ol.OVERVIEWMAP_MIN_RATIO ||
boxHeight < ovmapHeight * ol.OVERVIEWMAP_MIN_RATIO ||
boxWidth > ovmapWidth * ol.OVERVIEWMAP_MAX_RATIO ||
boxHeight > ovmapHeight * ol.OVERVIEWMAP_MAX_RATIO) {
this.resetExtent_();
} else if (!ol.extent.containsExtent(ovextent, extent)) {
this.recenter_();
@@ -396,10 +396,8 @@ ol.control.OverviewMap.prototype.updateBox_ = function() {
// set box size calculated from map extent size and overview map resolution
if (box) {
var boxWidth = Math.abs((bottomLeft[0] - topRight[0]) / ovresolution);
var boxHeight = Math.abs((topRight[1] - bottomLeft[1]) / ovresolution);
goog.style.setBorderBoxSize(box, new goog.math.Size(
boxWidth, boxHeight));
box.style.width = Math.abs((bottomLeft[0] - topRight[0]) / ovresolution) + 'px';
box.style.height = Math.abs((topRight[1] - bottomLeft[1]) / ovresolution) + 'px';
}
};