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:
@@ -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 = {};
|
||||
|
||||
Reference in New Issue
Block a user