Animate rotation when releasing mouse or fingers

This commit is contained in:
Éric Lemoine
2013-03-04 20:30:15 +01:00
parent c431acacca
commit d42d88c198
2 changed files with 18 additions and 2 deletions
+8 -1
View File
@@ -6,6 +6,12 @@ goog.require('ol.interaction.ConditionType');
goog.require('ol.interaction.Drag');
/**
* @define {number} Animation duration.
*/
ol.interaction.DRAGROTATE_ANIMATION_DURATION = 250;
/**
* @constructor
@@ -62,7 +68,8 @@ ol.interaction.DragRotate.prototype.handleDragEnd = function(mapBrowserEvent) {
// FIXME supports View2D only
var view = map.getView();
goog.asserts.assert(view instanceof ol.View2D);
view.rotate(map, view.getRotation());
view.rotate(map, view.getRotation(), undefined,
ol.interaction.DRAGROTATE_ANIMATION_DURATION);
view.setHint(ol.ViewHint.INTERACTING, -1);
};