Use view.animate() in zoom slider control
This commit is contained in:
@@ -233,19 +233,19 @@ ol.control.ZoomSlider.render = function(mapEvent) {
|
||||
* @private
|
||||
*/
|
||||
ol.control.ZoomSlider.prototype.handleContainerClick_ = function(event) {
|
||||
var map = this.getMap();
|
||||
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 view = this.getMap().getView();
|
||||
|
||||
var relativePosition = this.getRelativePosition_(
|
||||
event.offsetX - this.thumbSize_[0] / 2,
|
||||
event.offsetY - this.thumbSize_[1] / 2);
|
||||
|
||||
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