Permalink
Browse files

Animate rotation when releasing mouse or fingers

  • Loading branch information...
1 parent 33eb13d commit b9a286fb7ad9895e1c70726e61e1574df6f4aa09 @elemoine elemoine committed with tschaub Mar 4, 2013
Showing with 18 additions and 2 deletions.
  1. +8 −1 src/ol/interaction/dragrotateinteraction.js
  2. +10 −1 src/ol/interaction/touchrotateinteraction.js
View
9 src/ol/interaction/dragrotateinteraction.js
@@ -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);
};
View
11 src/ol/interaction/touchrotateinteraction.js
@@ -8,6 +8,14 @@ goog.require('ol.ViewHint');
goog.require('ol.interaction.Touch');
+/**
+ * @define {number} Animation duration.
+ */
+ol.interaction.TOUCHROTATE_ANIMATION_DURATION = 250;
+
+
+
+/**
/**
* @constructor
@@ -104,7 +112,8 @@ ol.interaction.TouchRotate.prototype.handleTouchEnd =
var map = mapBrowserEvent.map;
var view = map.getView();
if (this.rotating_) {
- view.rotate(map, view.getRotation());
+ view.rotate(map, view.getRotation(), undefined,
+ ol.interaction.TOUCHROTATE_ANIMATION_DURATION);
}
view.setHint(ol.ViewHint.INTERACTING, -1);
return false;

0 comments on commit b9a286f

Please sign in to comment.