Use view.animate() in the rotation control

This commit is contained in:
Tim Schaub
2016-11-05 18:11:04 -06:00
parent 0c8c5a003b
commit dd079e915a

View File

@@ -3,7 +3,6 @@ goog.provide('ol.control.Rotate');
goog.require('ol.events'); goog.require('ol.events');
goog.require('ol.events.EventType'); goog.require('ol.events.EventType');
goog.require('ol'); goog.require('ol');
goog.require('ol.animation');
goog.require('ol.control.Control'); goog.require('ol.control.Control');
goog.require('ol.css'); goog.require('ol.css');
goog.require('ol.easing'); goog.require('ol.easing');
@@ -131,14 +130,15 @@ ol.control.Rotate.prototype.resetNorth_ = function() {
if (currentRotation > Math.PI) { if (currentRotation > Math.PI) {
currentRotation -= 2 * Math.PI; currentRotation -= 2 * Math.PI;
} }
map.beforeRender(ol.animation.rotate({ view.animate({
rotation: currentRotation, rotation: 0,
duration: this.duration_, duration: this.duration_,
easing: ol.easing.easeOut easing: ol.easing.easeOut
})); });
} } else {
view.setRotation(0); view.setRotation(0);
} }
}
}; };