Use getContentBoxSize() for slider initialisation.
Initial note to revisit this came from @twpayne; thanks.
This commit is contained in:
@@ -192,25 +192,20 @@ ol.control.ZoomSlider.prototype.initMapEventListeners_ = function() {
|
|||||||
ol.control.ZoomSlider.prototype.initSlider_ = function() {
|
ol.control.ZoomSlider.prototype.initSlider_ = function() {
|
||||||
var container = this.element,
|
var container = this.element,
|
||||||
thumb = goog.dom.getFirstElementChild(container),
|
thumb = goog.dom.getFirstElementChild(container),
|
||||||
elemBounds = goog.style.getBounds(container),
|
elemSize = goog.style.getContentBoxSize(container),
|
||||||
elemPaddings = goog.style.getPaddingBox(container),
|
|
||||||
elemBorderBox = goog.style.getBorderBox(container),
|
|
||||||
thumbBounds = goog.style.getBounds(thumb),
|
thumbBounds = goog.style.getBounds(thumb),
|
||||||
thumbMargins = goog.style.getMarginBox(thumb),
|
thumbMargins = goog.style.getMarginBox(thumb),
|
||||||
thumbBorderBox = goog.style.getBorderBox(thumb),
|
thumbBorderBox = goog.style.getBorderBox(thumb),
|
||||||
w = elemBounds.width -
|
w = elemSize.width -
|
||||||
elemPaddings.left - elemPaddings.right -
|
|
||||||
thumbMargins.left - thumbMargins.right -
|
thumbMargins.left - thumbMargins.right -
|
||||||
thumbBorderBox.left - thumbBorderBox.right -
|
thumbBorderBox.left - thumbBorderBox.right -
|
||||||
thumbBounds.width,
|
thumbBounds.width,
|
||||||
h = elemBounds.height -
|
h = elemSize.height -
|
||||||
elemPaddings.top - elemPaddings.bottom -
|
|
||||||
thumbMargins.top - thumbMargins.bottom -
|
thumbMargins.top - thumbMargins.bottom -
|
||||||
thumbBorderBox.top - thumbBorderBox.bottom -
|
thumbBorderBox.top - thumbBorderBox.bottom -
|
||||||
thumbBounds.height,
|
thumbBounds.height,
|
||||||
limits;
|
limits;
|
||||||
// set the direction_ of the zoomslider and the allowed bounds for dragging
|
if (elemSize.width > elemSize.height) {
|
||||||
if (elemBounds.width > elemBounds.height) {
|
|
||||||
this.direction_ = ol.control.ZoomSlider.direction.HORIZONTAL;
|
this.direction_ = ol.control.ZoomSlider.direction.HORIZONTAL;
|
||||||
limits = new goog.math.Rect(0, 0, w, 0);
|
limits = new goog.math.Rect(0, 0, w, 0);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user