Disable rotation for views with enableRotation: false

This commit is contained in:
Andreas Hocevar
2017-06-08 17:29:19 +02:00
parent 9691130b83
commit 00c8a5845e
7 changed files with 104 additions and 35 deletions

View File

@@ -2,7 +2,6 @@ goog.provide('ol.View');
goog.require('ol');
goog.require('ol.CenterConstraint');
goog.require('ol.Constraints');
goog.require('ol.Object');
goog.require('ol.ResolutionConstraint');
goog.require('ol.RotationConstraint');
@@ -169,8 +168,11 @@ ol.View.prototype.applyOptions_ = function(options) {
* @private
* @type {ol.Constraints}
*/
this.constraints_ = new ol.Constraints(
centerConstraint, resolutionConstraint, rotationConstraint);
this.constraints_ = {
center: centerConstraint,
resolution: resolutionConstraint,
rotation: rotationConstraint
};
if (options.resolution !== undefined) {
properties[ol.ViewProperty.RESOLUTION] = options.resolution;
@@ -528,6 +530,14 @@ ol.View.prototype.getCenter = function() {
};
/**
* @return {ol.Constraints} Constraints.
*/
ol.View.prototype.getConstraints = function() {
return this.constraints_;
};
/**
* @param {Array.<number>=} opt_hints Destination array.
* @return {Array.<number>} Hint.