Use view.animate() in zoom slider control
This commit is contained in:
@@ -233,19 +233,19 @@ ol.control.ZoomSlider.render = function(mapEvent) {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.control.ZoomSlider.prototype.handleContainerClick_ = function(event) {
|
ol.control.ZoomSlider.prototype.handleContainerClick_ = function(event) {
|
||||||
var map = this.getMap();
|
var view = this.getMap().getView();
|
||||||
var view = map.getView();
|
|
||||||
var currentResolution = view.getResolution();
|
|
||||||
map.beforeRender(ol.animation.zoom({
|
|
||||||
resolution: /** @type {number} */ (currentResolution),
|
|
||||||
duration: this.duration_,
|
|
||||||
easing: ol.easing.easeOut
|
|
||||||
}));
|
|
||||||
var relativePosition = this.getRelativePosition_(
|
var relativePosition = this.getRelativePosition_(
|
||||||
event.offsetX - this.thumbSize_[0] / 2,
|
event.offsetX - this.thumbSize_[0] / 2,
|
||||||
event.offsetY - this.thumbSize_[1] / 2);
|
event.offsetY - this.thumbSize_[1] / 2);
|
||||||
|
|
||||||
var resolution = this.getResolutionForPosition_(relativePosition);
|
var resolution = this.getResolutionForPosition_(relativePosition);
|
||||||
view.setResolution(view.constrainResolution(resolution));
|
|
||||||
|
view.animate({
|
||||||
|
resolution: view.constrainResolution(resolution),
|
||||||
|
duration: this.duration_,
|
||||||
|
easing: ol.easing.easeOut
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user