From 0c8c5a003b9cacb1afee955bc220bf31a8762f9a Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sat, 5 Nov 2016 18:08:37 -0600 Subject: [PATCH] Use view.animate() in zoom control --- src/ol/control/zoom.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ol/control/zoom.js b/src/ol/control/zoom.js index 8b61d8c92d..390578d332 100644 --- a/src/ol/control/zoom.js +++ b/src/ol/control/zoom.js @@ -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); } };