Merge pull request #3176 from fredj/undefined-rotation
Disallowed undefined rotation value
This commit is contained in:
@@ -351,12 +351,12 @@ ol.View.prototype.getResolutionForValueFunction = function(opt_power) {
|
||||
|
||||
|
||||
/**
|
||||
* @return {number|undefined} The rotation of the view.
|
||||
* @return {number} The rotation of the view.
|
||||
* @observable
|
||||
* @api stable
|
||||
*/
|
||||
ol.View.prototype.getRotation = function() {
|
||||
return /** @type {number|undefined} */ (this.get(ol.ViewProperty.ROTATION));
|
||||
return /** @type {number} */ (this.get(ol.ViewProperty.ROTATION));
|
||||
};
|
||||
goog.exportProperty(
|
||||
ol.View.prototype,
|
||||
@@ -402,7 +402,7 @@ ol.View.prototype.getState = function() {
|
||||
center: center.slice(),
|
||||
projection: goog.isDef(projection) ? projection : null,
|
||||
resolution: resolution,
|
||||
rotation: goog.isDef(rotation) ? rotation : 0
|
||||
rotation: rotation
|
||||
});
|
||||
};
|
||||
|
||||
@@ -626,7 +626,7 @@ goog.exportProperty(
|
||||
|
||||
/**
|
||||
* Set the rotation for this view.
|
||||
* @param {number|undefined} rotation The rotation of the view.
|
||||
* @param {number} rotation The rotation of the view.
|
||||
* @observable
|
||||
* @api stable
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,24 @@
|
||||
goog.provide('ol.test.View');
|
||||
|
||||
describe('ol.View', function() {
|
||||
|
||||
describe('constructor (defaults)', function() {
|
||||
var view;
|
||||
|
||||
beforeEach(function() {
|
||||
view = new ol.View();
|
||||
});
|
||||
|
||||
it('creates an instance', function() {
|
||||
expect(view).to.be.a(ol.View);
|
||||
});
|
||||
|
||||
it('provides default rotation', function() {
|
||||
expect(view.getRotation()).to.be(0);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('create constraints', function() {
|
||||
|
||||
describe('create resolution constraint', function() {
|
||||
|
||||
Reference in New Issue
Block a user