ZoomSlider animates to final resolution
This commit is contained in:
@@ -18,6 +18,12 @@ goog.require('ol.control.Control');
|
|||||||
goog.require('ol.css');
|
goog.require('ol.css');
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @define {number} Animation duration.
|
||||||
|
*/
|
||||||
|
ol.control.ZOOMSLIDER_ANIMATION_DURATION = 200;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
@@ -248,9 +254,14 @@ ol.control.ZoomSlider.prototype.handleSliderChange_ = function(e) {
|
|||||||
var map = this.getMap(),
|
var map = this.getMap(),
|
||||||
amountDragged = this.amountDragged_(e),
|
amountDragged = this.amountDragged_(e),
|
||||||
res = this.resolutionForAmount_(amountDragged);
|
res = this.resolutionForAmount_(amountDragged);
|
||||||
if (res !== this.currentResolution_) {
|
if (e.type === goog.fx.Dragger.EventType.DRAG) {
|
||||||
this.currentResolution_ = res;
|
if (res !== this.currentResolution_) {
|
||||||
map.getView().setResolution(res);
|
this.currentResolution_ = res;
|
||||||
|
map.getView().zoomWithoutConstraints(map, res);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
map.getView().zoom(map, this.currentResolution_, undefined,
|
||||||
|
ol.control.ZOOMSLIDER_ANIMATION_DURATION);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user