Change ol.control.ZoomSlider#amountDragged_ signature
This commit is contained in:
@@ -209,17 +209,18 @@ ol.control.ZoomSlider.prototype.positionThumbForResolution_ = function(res) {
|
|||||||
* Calculates the amount the thumb has been dragged to allow for calculation
|
* Calculates the amount the thumb has been dragged to allow for calculation
|
||||||
* of the corresponding resolution.
|
* 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.
|
* @return {number} The amount the thumb has been dragged.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.control.ZoomSlider.prototype.amountDragged_ = function(e) {
|
ol.control.ZoomSlider.prototype.amountDragged_ = function(x, y) {
|
||||||
var draggerLimits = this.dragger_.limits,
|
var draggerLimits = this.dragger_.limits,
|
||||||
amount = 0;
|
amount = 0;
|
||||||
if (this.direction_ === ol.control.ZoomSlider.direction.HORIZONTAL) {
|
if (this.direction_ === ol.control.ZoomSlider.direction.HORIZONTAL) {
|
||||||
amount = (e.left - draggerLimits.left) / draggerLimits.width;
|
amount = (x - draggerLimits.left) / draggerLimits.width;
|
||||||
} else {
|
} else {
|
||||||
amount = (e.top - draggerLimits.top) / draggerLimits.height;
|
amount = (y - draggerLimits.top) / draggerLimits.height;
|
||||||
}
|
}
|
||||||
return amount;
|
return amount;
|
||||||
};
|
};
|
||||||
@@ -270,7 +271,7 @@ ol.control.ZoomSlider.prototype.handleSliderChange_ = function(e) {
|
|||||||
var view = map.getView().getView2D();
|
var view = map.getView().getView2D();
|
||||||
var resolution;
|
var resolution;
|
||||||
if (e.type === goog.fx.Dragger.EventType.DRAG) {
|
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);
|
resolution = this.resolutionForAmount_(amountDragged);
|
||||||
if (resolution !== this.currentResolution_) {
|
if (resolution !== this.currentResolution_) {
|
||||||
this.currentResolution_ = resolution;
|
this.currentResolution_ = resolution;
|
||||||
|
|||||||
Reference in New Issue
Block a user