Remove goog.isNull in map class
This commit is contained in:
@@ -597,7 +597,7 @@ ol.Map.prototype.disposeInternal = function() {
|
||||
*/
|
||||
ol.Map.prototype.forEachFeatureAtPixel =
|
||||
function(pixel, callback, opt_this, opt_layerFilter, opt_this2) {
|
||||
if (goog.isNull(this.frameState_)) {
|
||||
if (!this.frameState_) {
|
||||
return;
|
||||
}
|
||||
var coordinate = this.getCoordinateFromPixel(pixel);
|
||||
@@ -635,7 +635,7 @@ ol.Map.prototype.forEachFeatureAtPixel =
|
||||
*/
|
||||
ol.Map.prototype.forEachLayerAtPixel =
|
||||
function(pixel, callback, opt_this, opt_layerFilter, opt_this2) {
|
||||
if (goog.isNull(this.frameState_)) {
|
||||
if (!this.frameState_) {
|
||||
return;
|
||||
}
|
||||
var thisArg = opt_this !== undefined ? opt_this : null;
|
||||
@@ -665,7 +665,7 @@ ol.Map.prototype.forEachLayerAtPixel =
|
||||
*/
|
||||
ol.Map.prototype.hasFeatureAtPixel =
|
||||
function(pixel, opt_layerFilter, opt_this) {
|
||||
if (goog.isNull(this.frameState_)) {
|
||||
if (!this.frameState_) {
|
||||
return false;
|
||||
}
|
||||
var coordinate = this.getCoordinateFromPixel(pixel);
|
||||
@@ -737,7 +737,7 @@ ol.Map.prototype.getTargetElement = function() {
|
||||
*/
|
||||
ol.Map.prototype.getCoordinateFromPixel = function(pixel) {
|
||||
var frameState = this.frameState_;
|
||||
if (goog.isNull(frameState)) {
|
||||
if (!frameState) {
|
||||
return null;
|
||||
} else {
|
||||
var vec2 = pixel.slice();
|
||||
@@ -812,7 +812,7 @@ ol.Map.prototype.getLayers = function() {
|
||||
*/
|
||||
ol.Map.prototype.getPixelFromCoordinate = function(coordinate) {
|
||||
var frameState = this.frameState_;
|
||||
if (goog.isNull(frameState)) {
|
||||
if (!frameState) {
|
||||
return null;
|
||||
} else {
|
||||
var vec2 = coordinate.slice(0, 2);
|
||||
@@ -899,7 +899,7 @@ ol.Map.prototype.getTilePriority =
|
||||
// Filter out tiles at higher zoom levels than the current zoom level, or that
|
||||
// are outside the visible extent.
|
||||
var frameState = this.frameState_;
|
||||
if (goog.isNull(frameState) || !(tileSourceKey in frameState.wantedTiles)) {
|
||||
if (!frameState || !(tileSourceKey in frameState.wantedTiles)) {
|
||||
return ol.structs.PriorityQueue.DROP;
|
||||
}
|
||||
var coordKey = ol.tilecoord.toString(tile.tileCoord);
|
||||
@@ -934,7 +934,7 @@ ol.Map.prototype.handleBrowserEvent = function(browserEvent, opt_type) {
|
||||
* @param {ol.MapBrowserEvent} mapBrowserEvent The event to handle.
|
||||
*/
|
||||
ol.Map.prototype.handleMapBrowserEvent = function(mapBrowserEvent) {
|
||||
if (goog.isNull(this.frameState_)) {
|
||||
if (!this.frameState_) {
|
||||
// With no view defined, we cannot translate pixels into geographical
|
||||
// coordinates so interactions cannot be used.
|
||||
return;
|
||||
@@ -982,7 +982,7 @@ ol.Map.prototype.handlePostRender = function() {
|
||||
var maxTotalLoading = 16;
|
||||
var maxNewLoads = maxTotalLoading;
|
||||
var tileSourceCount = 0;
|
||||
if (!goog.isNull(frameState)) {
|
||||
if (frameState) {
|
||||
var hints = frameState.viewHints;
|
||||
if (hints[ol.ViewHint.ANIMATING]) {
|
||||
maxTotalLoading = this.loadTilesWhileAnimating_ ? 8 : 0;
|
||||
@@ -1032,20 +1032,20 @@ ol.Map.prototype.handleTargetChanged_ = function() {
|
||||
|
||||
this.keyHandler_.detach();
|
||||
|
||||
if (goog.isNull(targetElement)) {
|
||||
if (!targetElement) {
|
||||
goog.dom.removeNode(this.viewport_);
|
||||
if (!goog.isNull(this.viewportResizeListenerKey_)) {
|
||||
if (this.viewportResizeListenerKey_) {
|
||||
goog.events.unlistenByKey(this.viewportResizeListenerKey_);
|
||||
this.viewportResizeListenerKey_ = null;
|
||||
}
|
||||
} else {
|
||||
goog.dom.appendChild(targetElement, this.viewport_);
|
||||
|
||||
var keyboardEventTarget = goog.isNull(this.keyboardEventTarget_) ?
|
||||
var keyboardEventTarget = !this.keyboardEventTarget_ ?
|
||||
targetElement : this.keyboardEventTarget_;
|
||||
this.keyHandler_.attach(keyboardEventTarget);
|
||||
|
||||
if (goog.isNull(this.viewportResizeListenerKey_)) {
|
||||
if (!this.viewportResizeListenerKey_) {
|
||||
this.viewportResizeListenerKey_ = goog.events.listen(
|
||||
this.viewportSizeMonitor_, goog.events.EventType.RESIZE,
|
||||
this.updateSize, false, this);
|
||||
@@ -1078,12 +1078,12 @@ ol.Map.prototype.handleViewPropertyChanged_ = function() {
|
||||
* @private
|
||||
*/
|
||||
ol.Map.prototype.handleViewChanged_ = function() {
|
||||
if (!goog.isNull(this.viewPropertyListenerKey_)) {
|
||||
if (this.viewPropertyListenerKey_) {
|
||||
goog.events.unlistenByKey(this.viewPropertyListenerKey_);
|
||||
this.viewPropertyListenerKey_ = null;
|
||||
}
|
||||
var view = this.getView();
|
||||
if (!goog.isNull(view)) {
|
||||
if (view) {
|
||||
this.viewPropertyListenerKey_ = goog.events.listen(
|
||||
view, ol.ObjectEventType.PROPERTYCHANGE,
|
||||
this.handleViewPropertyChanged_, false, this);
|
||||
@@ -1118,7 +1118,7 @@ ol.Map.prototype.handleLayerGroupPropertyChanged_ = function(event) {
|
||||
* @private
|
||||
*/
|
||||
ol.Map.prototype.handleLayerGroupChanged_ = function() {
|
||||
if (!goog.isNull(this.layerGroupPropertyListenerKeys_)) {
|
||||
if (this.layerGroupPropertyListenerKeys_) {
|
||||
this.layerGroupPropertyListenerKeys_.forEach(goog.events.unlistenByKey);
|
||||
this.layerGroupPropertyListenerKeys_ = null;
|
||||
}
|
||||
@@ -1155,7 +1155,7 @@ ol.Map.prototype.isDef = function() {
|
||||
return false;
|
||||
}
|
||||
var view = this.getView();
|
||||
if (goog.isNull(view) || !view.isDef()) {
|
||||
if (!view || !view.isDef()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -1166,7 +1166,7 @@ ol.Map.prototype.isDef = function() {
|
||||
* @return {boolean} Is rendered.
|
||||
*/
|
||||
ol.Map.prototype.isRendered = function() {
|
||||
return !goog.isNull(this.frameState_);
|
||||
return this.frameState_ !== null;
|
||||
};
|
||||
|
||||
|
||||
@@ -1259,7 +1259,7 @@ ol.Map.prototype.renderFrame_ = function(time) {
|
||||
/** @type {?olx.FrameState} */
|
||||
var frameState = null;
|
||||
if (size !== undefined && ol.size.hasArea(size) &&
|
||||
!goog.isNull(view) && view.isDef()) {
|
||||
view && view.isDef()) {
|
||||
var viewHints = view.getHints();
|
||||
var layerStatesArray = this.getLayerGroup().getLayerStatesArray();
|
||||
var layerStates = {};
|
||||
@@ -1272,7 +1272,7 @@ ol.Map.prototype.renderFrame_ = function(time) {
|
||||
attributions: {},
|
||||
coordinateToPixelMatrix: this.coordinateToPixelMatrix_,
|
||||
extent: null,
|
||||
focus: goog.isNull(this.focus_) ? viewState.center : this.focus_,
|
||||
focus: !this.focus_ ? viewState.center : this.focus_,
|
||||
index: this.frameIndex_++,
|
||||
layerStates: layerStates,
|
||||
layerStatesArray: layerStatesArray,
|
||||
@@ -1291,7 +1291,7 @@ ol.Map.prototype.renderFrame_ = function(time) {
|
||||
});
|
||||
}
|
||||
|
||||
if (!goog.isNull(frameState)) {
|
||||
if (frameState) {
|
||||
var preRenderFunctions = this.preRenderFunctions_;
|
||||
var n = 0, preRenderFunction;
|
||||
for (i = 0, ii = preRenderFunctions.length; i < ii; ++i) {
|
||||
@@ -1309,7 +1309,7 @@ ol.Map.prototype.renderFrame_ = function(time) {
|
||||
this.frameState_ = frameState;
|
||||
this.renderer_.renderFrame(frameState);
|
||||
|
||||
if (!goog.isNull(frameState)) {
|
||||
if (frameState) {
|
||||
if (frameState.animate) {
|
||||
this.render();
|
||||
}
|
||||
@@ -1400,7 +1400,7 @@ ol.Map.prototype.skipFeature = function(feature) {
|
||||
ol.Map.prototype.updateSize = function() {
|
||||
var targetElement = this.getTargetElement();
|
||||
|
||||
if (goog.isNull(targetElement)) {
|
||||
if (!targetElement) {
|
||||
this.setSize(undefined);
|
||||
} else {
|
||||
var size = goog.style.getContentBoxSize(targetElement);
|
||||
|
||||
Reference in New Issue
Block a user