Use view.animate() in zoom control

This commit is contained in:
Tim Schaub
2016-11-05 18:08:37 -06:00
parent 61ef7bf95d
commit 0c8c5a003b

View File

@@ -3,7 +3,6 @@ goog.provide('ol.control.Zoom');
goog.require('ol');
goog.require('ol.events');
goog.require('ol.events.EventType');
goog.require('ol.animation');
goog.require('ol.control.Control');
goog.require('ol.css');
goog.require('ol.easing');
@@ -105,14 +104,15 @@ ol.control.Zoom.prototype.zoomByDelta_ = function(delta) {
}
var currentResolution = view.getResolution();
if (currentResolution) {
var newResolution = view.constrainResolution(currentResolution, delta);
if (this.duration_ > 0) {
map.beforeRender(ol.animation.zoom({
resolution: currentResolution,
view.animate({
resolution: newResolution,
duration: this.duration_,
easing: ol.easing.easeOut
}));
});
} else {
view.setResolution(newResolution);
}
var newResolution = view.constrainResolution(currentResolution, delta);
view.setResolution(newResolution);
}
};