diff --git a/src/objectliterals.jsdoc b/src/objectliterals.jsdoc index 6c1c23e5f1..7963ec4487 100644 --- a/src/objectliterals.jsdoc +++ b/src/objectliterals.jsdoc @@ -91,6 +91,8 @@ * The coordinate system for the center is specified with the `projection` * option. Default is `undefined`, and layer sources will not be fetched if * this is not set. + * @property {boolean|undefined} enableRotation Enable rotation. Default is + * `true`. * @property {ol.Extent|undefined} extent The extent that constrains the center, * in other words, center cannot be set outside this extent. * Default is `undefined`. diff --git a/src/ol/view2d.js b/src/ol/view2d.js index 057337f514..c7001a5096 100644 --- a/src/ol/view2d.js +++ b/src/ol/view2d.js @@ -569,6 +569,11 @@ ol.View2D.createResolutionConstraint_ = function(options) { * @return {ol.RotationConstraintType} Rotation constraint. */ ol.View2D.createRotationConstraint_ = function(options) { - // FIXME rotation constraint is not configurable at the moment - return ol.RotationConstraint.createSnapToZero(); + var enableRotation = goog.isDef(options.enableRotation) ? + options.enableRotation : true; + if (enableRotation) { + return ol.RotationConstraint.createSnapToZero(); + } else { + return ol.RotationConstraint.disable; + } };