Make ol.Map#setView do not accept undefined

With this change map.setView(null) is permitted, but map.setView(undefined) is not. map.getView now always returns a defined value, which may be null is setView was called with null.
This commit is contained in:
Éric Lemoine
2014-09-17 11:25:14 +02:00
parent 163cc5b873
commit cb8b896230
8 changed files with 11 additions and 11 deletions

View File

@@ -753,7 +753,7 @@ goog.exportProperty(
/**
* Get the view associated with this map. A view manages properties such as
* center and resolution.
* @return {ol.View|undefined} The view that controls this map.
* @return {ol.View} The view that controls this map.
* @observable
* @api stable
*/
@@ -988,7 +988,7 @@ ol.Map.prototype.handleViewChanged_ = function() {
this.viewPropertyListenerKey_ = null;
}
var view = this.getView();
if (goog.isDefAndNotNull(view)) {
if (!goog.isNull(view)) {
this.viewPropertyListenerKey_ = goog.events.listen(
view, ol.ObjectEventType.PROPERTYCHANGE,
this.handleViewPropertyChanged_, false, this);
@@ -1061,7 +1061,7 @@ ol.Map.prototype.isDef = function() {
return false;
}
var view = this.getView();
if (!goog.isDef(view) || !view.isDef()) {
if (goog.isNull(view) || !view.isDef()) {
return false;
}
return true;
@@ -1189,7 +1189,7 @@ ol.Map.prototype.renderFrame_ = function(time) {
/** @type {?olx.FrameState} */
var frameState = null;
if (goog.isDef(size) && hasArea(size) &&
goog.isDef(view) && view.isDef()) {
!goog.isNull(view) && view.isDef()) {
var viewHints = view.getHints();
var layerStatesArray = this.getLayerGroup().getLayerStatesArray();
var layerStates = {};