Do not apply rotation constraint while rotating
This is on par to what the TouchRotate interaction does.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
goog.provide('ol.interaction.DragRotate');
|
||||
|
||||
goog.require('ol.View2D');
|
||||
goog.require('ol.ViewHint');
|
||||
goog.require('ol.interaction.ConditionType');
|
||||
goog.require('ol.interaction.Drag');
|
||||
|
||||
@@ -46,12 +47,26 @@ ol.interaction.DragRotate.prototype.handleDrag = function(mapBrowserEvent) {
|
||||
// FIXME supports View2D only
|
||||
goog.asserts.assert(view instanceof ol.View2D);
|
||||
map.requestRenderFrame();
|
||||
view.rotate(map, view.getRotation() - delta);
|
||||
view.rotateNoConstraint(map, view.getRotation() - delta);
|
||||
}
|
||||
this.lastAngle_ = theta;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.interaction.DragRotate.prototype.handleDragEnd = function(mapBrowserEvent) {
|
||||
var browserEvent = mapBrowserEvent.browserEvent;
|
||||
var map = mapBrowserEvent.map;
|
||||
// FIXME supports View2D only
|
||||
var view = map.getView();
|
||||
goog.asserts.assert(view instanceof ol.View2D);
|
||||
view.rotate(map, view.getRotation());
|
||||
view.setHint(ol.ViewHint.INTERACTING, -1);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
@@ -65,6 +80,7 @@ ol.interaction.DragRotate.prototype.handleDragStart =
|
||||
goog.asserts.assert(view instanceof ol.View2D);
|
||||
map.requestRenderFrame();
|
||||
this.lastAngle_ = undefined;
|
||||
view.setHint(ol.ViewHint.INTERACTING, 1);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user