From 1147d51f2fc4e5d043caa54613f7e524875f4884 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sun, 6 Nov 2016 07:59:48 -0700 Subject: [PATCH] Use view.animate() in drag zoom interaction --- src/ol/interaction/dragzoom.js | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/ol/interaction/dragzoom.js b/src/ol/interaction/dragzoom.js index fa9652b492..ab54c2e467 100644 --- a/src/ol/interaction/dragzoom.js +++ b/src/ol/interaction/dragzoom.js @@ -1,7 +1,6 @@ goog.provide('ol.interaction.DragZoom'); goog.require('ol'); -goog.require('ol.animation'); goog.require('ol.easing'); goog.require('ol.events.condition'); goog.require('ol.extent'); @@ -75,21 +74,11 @@ ol.interaction.DragZoom.prototype.onBoxEnd = function() { var resolution = view.constrainResolution( view.getResolutionForExtent(extent, size)); - var currentResolution = /** @type {number} */ (view.getResolution()); - - var currentCenter = /** @type {!ol.Coordinate} */ (view.getCenter()); - - map.beforeRender(ol.animation.zoom({ - resolution: currentResolution, + view.animate({ + resolution: resolution, + center: ol.extent.getCenter(extent), duration: this.duration_, 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); };