Use view.animate() in drag zoom interaction
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
goog.provide('ol.interaction.DragZoom');
|
goog.provide('ol.interaction.DragZoom');
|
||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.animation');
|
|
||||||
goog.require('ol.easing');
|
goog.require('ol.easing');
|
||||||
goog.require('ol.events.condition');
|
goog.require('ol.events.condition');
|
||||||
goog.require('ol.extent');
|
goog.require('ol.extent');
|
||||||
@@ -75,21 +74,11 @@ ol.interaction.DragZoom.prototype.onBoxEnd = function() {
|
|||||||
var resolution = view.constrainResolution(
|
var resolution = view.constrainResolution(
|
||||||
view.getResolutionForExtent(extent, size));
|
view.getResolutionForExtent(extent, size));
|
||||||
|
|
||||||
var currentResolution = /** @type {number} */ (view.getResolution());
|
view.animate({
|
||||||
|
resolution: resolution,
|
||||||
var currentCenter = /** @type {!ol.Coordinate} */ (view.getCenter());
|
center: ol.extent.getCenter(extent),
|
||||||
|
|
||||||
map.beforeRender(ol.animation.zoom({
|
|
||||||
resolution: currentResolution,
|
|
||||||
duration: this.duration_,
|
duration: this.duration_,
|
||||||
easing: ol.easing.easeOut
|
easing: ol.easing.easeOut
|
||||||
}));
|
});
|
||||||
map.beforeRender(ol.animation.pan({
|
|
||||||
source: currentCenter,
|
|
||||||
duration: this.duration_,
|
|
||||||
easing: ol.easing.easeOut
|
|
||||||
}));
|
|
||||||
|
|
||||||
view.setCenter(ol.extent.getCenter(extent));
|
|
||||||
view.setResolution(resolution);
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user