Use view.animation() when rotating
This commit is contained in:
@@ -4,7 +4,6 @@ goog.provide('ol.interaction.Interaction');
|
|||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.Object');
|
goog.require('ol.Object');
|
||||||
goog.require('ol.animation');
|
|
||||||
goog.require('ol.easing');
|
goog.require('ol.easing');
|
||||||
|
|
||||||
|
|
||||||
@@ -139,22 +138,16 @@ ol.interaction.Interaction.rotateWithoutConstraints = function(map, view, rotati
|
|||||||
if (rotation !== undefined) {
|
if (rotation !== undefined) {
|
||||||
var currentRotation = view.getRotation();
|
var currentRotation = view.getRotation();
|
||||||
var currentCenter = view.getCenter();
|
var currentCenter = view.getCenter();
|
||||||
if (currentRotation !== undefined && currentCenter &&
|
if (currentRotation !== undefined && currentCenter && opt_duration > 0) {
|
||||||
opt_duration && opt_duration > 0) {
|
view.animate({
|
||||||
map.beforeRender(ol.animation.rotate({
|
rotation: rotation,
|
||||||
rotation: currentRotation,
|
anchor: opt_anchor,
|
||||||
duration: opt_duration,
|
duration: opt_duration,
|
||||||
easing: ol.easing.easeOut
|
easing: ol.easing.easeOut
|
||||||
}));
|
});
|
||||||
if (opt_anchor) {
|
} else {
|
||||||
map.beforeRender(ol.animation.pan({
|
view.rotate(rotation, opt_anchor);
|
||||||
source: currentCenter,
|
|
||||||
duration: opt_duration,
|
|
||||||
easing: ol.easing.easeOut
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
view.rotate(rotation, opt_anchor);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user