Allow thumb to range over the entire container size

This commit is contained in:
Tim Schaub
2014-10-13 08:40:51 -06:00
parent 6f20afeba9
commit b8369ad3f0

View File

@@ -127,22 +127,22 @@ ol.control.ZoomSlider.prototype.setMap = function(map) {
* @private * @private
*/ */
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), var containerSize = goog.style.getSize(container);
elemSize = goog.style.getContentBoxSize(container), var thumb = goog.dom.getFirstElementChild(container);
thumbBounds = goog.style.getBounds(thumb), var thumbBounds = goog.style.getBounds(thumb);
thumbMargins = goog.style.getMarginBox(thumb), var thumbMargins = goog.style.getMarginBox(thumb);
thumbBorderBox = goog.style.getBorderBox(thumb), var thumbBorderBox = goog.style.getBorderBox(thumb);
w = elemSize.width - var w = containerSize.width -
thumbMargins.left - thumbMargins.right - thumbMargins.left - thumbMargins.right -
thumbBorderBox.left - thumbBorderBox.right - thumbBorderBox.left - thumbBorderBox.right -
thumbBounds.width, thumbBounds.width;
h = elemSize.height - var h = containerSize.height -
thumbMargins.top - thumbMargins.bottom - thumbMargins.top - thumbMargins.bottom -
thumbBorderBox.top - thumbBorderBox.bottom - thumbBorderBox.top - thumbBorderBox.bottom -
thumbBounds.height, thumbBounds.height;
limits; var limits;
if (elemSize.width > elemSize.height) { if (containerSize.width > containerSize.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 {