Use view.animate() in zoom control
This commit is contained in:
@@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user