From 9ff7470f657089f9536ea6aaa97d5e3e4c924da3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Sat, 16 Nov 2013 23:51:53 +0100 Subject: [PATCH] Change ol.control.ZoomSlider#amountDragged_ signature --- src/ol/control/zoomslidercontrol.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/ol/control/zoomslidercontrol.js b/src/ol/control/zoomslidercontrol.js index 27516911e7..f1bee5d6ce 100644 --- a/src/ol/control/zoomslidercontrol.js +++ b/src/ol/control/zoomslidercontrol.js @@ -209,17 +209,18 @@ ol.control.ZoomSlider.prototype.positionThumbForResolution_ = function(res) { * Calculates the amount the thumb has been dragged to allow for calculation * of the corresponding resolution. * - * @param {goog.fx.DragDropEvent} e The dragdropevent. + * @param {number} x Pixel position relative to the left of the slider. + * @param {number} y Pixel position relative to the top of the slider. * @return {number} The amount the thumb has been dragged. * @private */ -ol.control.ZoomSlider.prototype.amountDragged_ = function(e) { +ol.control.ZoomSlider.prototype.amountDragged_ = function(x, y) { var draggerLimits = this.dragger_.limits, amount = 0; if (this.direction_ === ol.control.ZoomSlider.direction.HORIZONTAL) { - amount = (e.left - draggerLimits.left) / draggerLimits.width; + amount = (x - draggerLimits.left) / draggerLimits.width; } else { - amount = (e.top - draggerLimits.top) / draggerLimits.height; + amount = (y - draggerLimits.top) / draggerLimits.height; } return amount; }; @@ -270,7 +271,7 @@ ol.control.ZoomSlider.prototype.handleSliderChange_ = function(e) { var view = map.getView().getView2D(); var resolution; if (e.type === goog.fx.Dragger.EventType.DRAG) { - var amountDragged = this.amountDragged_(e); + var amountDragged = this.amountDragged_(e.left, e.top); resolution = this.resolutionForAmount_(amountDragged); if (resolution !== this.currentResolution_) { this.currentResolution_ = resolution;