From f16d1b06eb3ea1eaeabd9335c1729b9be2601bfc Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sun, 6 Nov 2016 08:04:38 -0700 Subject: [PATCH] Use view.animation() when rotating --- src/ol/interaction/interaction.js | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/ol/interaction/interaction.js b/src/ol/interaction/interaction.js index 74d2cfb622..67647dcb0f 100644 --- a/src/ol/interaction/interaction.js +++ b/src/ol/interaction/interaction.js @@ -4,7 +4,6 @@ goog.provide('ol.interaction.Interaction'); goog.require('ol'); goog.require('ol.Object'); -goog.require('ol.animation'); goog.require('ol.easing'); @@ -139,22 +138,16 @@ ol.interaction.Interaction.rotateWithoutConstraints = function(map, view, rotati if (rotation !== undefined) { var currentRotation = view.getRotation(); var currentCenter = view.getCenter(); - if (currentRotation !== undefined && currentCenter && - opt_duration && opt_duration > 0) { - map.beforeRender(ol.animation.rotate({ - rotation: currentRotation, + if (currentRotation !== undefined && currentCenter && opt_duration > 0) { + view.animate({ + rotation: rotation, + anchor: opt_anchor, duration: opt_duration, easing: ol.easing.easeOut - })); - if (opt_anchor) { - map.beforeRender(ol.animation.pan({ - source: currentCenter, - duration: opt_duration, - easing: ol.easing.easeOut - })); - } + }); + } else { + view.rotate(rotation, opt_anchor); } - view.rotate(rotation, opt_anchor); } };