Use view.animation() when rotating

This commit is contained in:
Tim Schaub
2016-11-06 08:04:38 -07:00
parent 1147d51f2f
commit f16d1b06eb

View File

@@ -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);
}
};