Add enableRotation option to ol.View2D
This commit is contained in:
@@ -91,6 +91,8 @@
|
|||||||
* The coordinate system for the center is specified with the `projection`
|
* The coordinate system for the center is specified with the `projection`
|
||||||
* option. Default is `undefined`, and layer sources will not be fetched if
|
* option. Default is `undefined`, and layer sources will not be fetched if
|
||||||
* this is not set.
|
* this is not set.
|
||||||
|
* @property {boolean|undefined} enableRotation Enable rotation. Default is
|
||||||
|
* `true`.
|
||||||
* @property {ol.Extent|undefined} extent The extent that constrains the center,
|
* @property {ol.Extent|undefined} extent The extent that constrains the center,
|
||||||
* in other words, center cannot be set outside this extent.
|
* in other words, center cannot be set outside this extent.
|
||||||
* Default is `undefined`.
|
* Default is `undefined`.
|
||||||
|
|||||||
+7
-2
@@ -569,6 +569,11 @@ ol.View2D.createResolutionConstraint_ = function(options) {
|
|||||||
* @return {ol.RotationConstraintType} Rotation constraint.
|
* @return {ol.RotationConstraintType} Rotation constraint.
|
||||||
*/
|
*/
|
||||||
ol.View2D.createRotationConstraint_ = function(options) {
|
ol.View2D.createRotationConstraint_ = function(options) {
|
||||||
// FIXME rotation constraint is not configurable at the moment
|
var enableRotation = goog.isDef(options.enableRotation) ?
|
||||||
return ol.RotationConstraint.createSnapToZero();
|
options.enableRotation : true;
|
||||||
|
if (enableRotation) {
|
||||||
|
return ol.RotationConstraint.createSnapToZero();
|
||||||
|
} else {
|
||||||
|
return ol.RotationConstraint.disable;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user