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.provide('ol.interaction.DragRotate');
|
||||||
|
|
||||||
goog.require('ol.View2D');
|
goog.require('ol.View2D');
|
||||||
|
goog.require('ol.ViewHint');
|
||||||
goog.require('ol.interaction.ConditionType');
|
goog.require('ol.interaction.ConditionType');
|
||||||
goog.require('ol.interaction.Drag');
|
goog.require('ol.interaction.Drag');
|
||||||
|
|
||||||
@@ -46,12 +47,26 @@ ol.interaction.DragRotate.prototype.handleDrag = function(mapBrowserEvent) {
|
|||||||
// FIXME supports View2D only
|
// FIXME supports View2D only
|
||||||
goog.asserts.assert(view instanceof ol.View2D);
|
goog.asserts.assert(view instanceof ol.View2D);
|
||||||
map.requestRenderFrame();
|
map.requestRenderFrame();
|
||||||
view.rotate(map, view.getRotation() - delta);
|
view.rotateNoConstraint(map, view.getRotation() - delta);
|
||||||
}
|
}
|
||||||
this.lastAngle_ = theta;
|
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
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
@@ -65,6 +80,7 @@ ol.interaction.DragRotate.prototype.handleDragStart =
|
|||||||
goog.asserts.assert(view instanceof ol.View2D);
|
goog.asserts.assert(view instanceof ol.View2D);
|
||||||
map.requestRenderFrame();
|
map.requestRenderFrame();
|
||||||
this.lastAngle_ = undefined;
|
this.lastAngle_ = undefined;
|
||||||
|
view.setHint(ol.ViewHint.INTERACTING, 1);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user