Avoid creation of unnecessary object literals
This commit is contained in:
committed by
Nicholas L
parent
0fef14137c
commit
030c0dad3d
@@ -189,20 +189,13 @@ ol.control.ZoomSlider.prototype.initSlider_ = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var thumb = container.firstElementChild;
|
var thumb = container.firstElementChild;
|
||||||
var thumbComputedStyles = window.getComputedStyle(thumb);
|
var computedStyle = ol.global.getComputedStyle(thumb);
|
||||||
var thumbMargins = {
|
var thumbWidth = thumb.offsetWidth +
|
||||||
left: parseFloat(thumbComputedStyles['marginLeft']),
|
parseFloat(computedStyle['marginRight']) +
|
||||||
right: parseFloat(thumbComputedStyles['marginRight']),
|
parseFloat(computedStyle['marginLeft']);
|
||||||
top: parseFloat(thumbComputedStyles['marginTop']),
|
var thumbHeight = thumb.offsetHeight +
|
||||||
bottom: parseFloat(thumbComputedStyles['marginBottom'])
|
parseFloat(computedStyle['marginTop']) +
|
||||||
};
|
parseFloat(computedStyle['marginBottom']);
|
||||||
var thumbBorderBoxSize = {
|
|
||||||
width:thumb.offsetWidth, height: thumb.offsetHeight
|
|
||||||
};
|
|
||||||
var thumbWidth = thumbBorderBoxSize.width +
|
|
||||||
thumbMargins.right + thumbMargins.left;
|
|
||||||
var thumbHeight = thumbBorderBoxSize.height +
|
|
||||||
thumbMargins.top + thumbMargins.bottom;
|
|
||||||
this.thumbSize_ = [thumbWidth, thumbHeight];
|
this.thumbSize_ = [thumbWidth, thumbHeight];
|
||||||
|
|
||||||
if (containerSize.width > containerSize.height) {
|
if (containerSize.width > containerSize.height) {
|
||||||
|
|||||||
+13
-25
@@ -1425,31 +1425,19 @@ ol.Map.prototype.updateSize = function() {
|
|||||||
if (!targetElement) {
|
if (!targetElement) {
|
||||||
this.setSize(undefined);
|
this.setSize(undefined);
|
||||||
} else {
|
} else {
|
||||||
var targetElementComputedStyle = window.getComputedStyle(targetElement);
|
var computedStyle = ol.global.getComputedStyle(targetElement);
|
||||||
var borderBoxSize = {
|
this.setSize([
|
||||||
width: targetElement.offsetWidth, height: targetElement.offsetHeight
|
targetElement.offsetWidth -
|
||||||
};
|
parseFloat(computedStyle['borderLeftWidth']) -
|
||||||
var paddingBox = {
|
parseFloat(computedStyle['paddingLeft']) -
|
||||||
left: parseFloat(targetElementComputedStyle['paddingLeft']),
|
parseFloat(computedStyle['paddingRight']) -
|
||||||
right: parseFloat(targetElementComputedStyle['paddingRight']),
|
parseFloat(computedStyle['borderRightWidth']),
|
||||||
top: parseFloat(targetElementComputedStyle['paddingTop']),
|
targetElement.offsetHeight -
|
||||||
bottom: parseFloat(targetElementComputedStyle['paddingBottom'])
|
parseFloat(computedStyle['borderTopWidth']) -
|
||||||
};
|
parseFloat(computedStyle['paddingTop']) -
|
||||||
var borderBox = {
|
parseFloat(computedStyle['paddingBottom']) -
|
||||||
left: parseFloat(targetElementComputedStyle['borderLeftWidth']),
|
parseFloat(computedStyle['borderBottomWidth'])
|
||||||
right: parseFloat(targetElementComputedStyle['borderRightWidth']),
|
]);
|
||||||
top: parseFloat(targetElementComputedStyle['borderTopWidth']),
|
|
||||||
bottom: parseFloat(targetElementComputedStyle['borderBottomWidth'])
|
|
||||||
};
|
|
||||||
var size = {
|
|
||||||
width: borderBoxSize.width -
|
|
||||||
borderBox.left - paddingBox.left -
|
|
||||||
paddingBox.right - borderBox.right,
|
|
||||||
height: borderBoxSize.height -
|
|
||||||
borderBox.top - paddingBox.top -
|
|
||||||
paddingBox.bottom - borderBox.bottom
|
|
||||||
};
|
|
||||||
this.setSize([size.width, size.height]);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user