Animate rotation when releasing mouse or fingers
This commit is contained in:
@@ -6,6 +6,12 @@ goog.require('ol.interaction.ConditionType');
|
|||||||
goog.require('ol.interaction.Drag');
|
goog.require('ol.interaction.Drag');
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @define {number} Animation duration.
|
||||||
|
*/
|
||||||
|
ol.interaction.DRAGROTATE_ANIMATION_DURATION = 250;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
@@ -62,7 +68,8 @@ ol.interaction.DragRotate.prototype.handleDragEnd = function(mapBrowserEvent) {
|
|||||||
// FIXME supports View2D only
|
// FIXME supports View2D only
|
||||||
var view = map.getView();
|
var view = map.getView();
|
||||||
goog.asserts.assert(view instanceof ol.View2D);
|
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.setHint(ol.ViewHint.INTERACTING, -1);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,14 @@ goog.require('ol.ViewHint');
|
|||||||
goog.require('ol.interaction.Touch');
|
goog.require('ol.interaction.Touch');
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @define {number} Animation duration.
|
||||||
|
*/
|
||||||
|
ol.interaction.TOUCHROTATE_ANIMATION_DURATION = 250;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
@@ -104,7 +112,8 @@ ol.interaction.TouchRotate.prototype.handleTouchEnd =
|
|||||||
var map = mapBrowserEvent.map;
|
var map = mapBrowserEvent.map;
|
||||||
var view = map.getView();
|
var view = map.getView();
|
||||||
if (this.rotating_) {
|
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);
|
view.setHint(ol.ViewHint.INTERACTING, -1);
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user