Move the nullFunction to ol/functions

And rename it to `UNDEFINED`.
This commit is contained in:
Frederic Junod
2018-03-01 10:52:23 +01:00
parent a30d9a41b8
commit b50a47114e
21 changed files with 72 additions and 63 deletions
+3 -3
View File
@@ -1,13 +1,13 @@
/**
* @module ol/renderer/Layer
*/
import {getUid, inherits, nullFunction} from '../index.js';
import {getUid, inherits} from '../index.js';
import ImageState from '../ImageState.js';
import Observable from '../Observable.js';
import TileState from '../TileState.js';
import {listen} from '../events.js';
import EventType from '../events/EventType.js';
import {FALSE} from '../functions.js';
import {FALSE, UNDEFINED} from '../functions.js';
import SourceState from '../source/State.js';
/**
@@ -42,7 +42,7 @@ inherits(LayerRenderer, Observable);
* @return {T|undefined} Callback result.
* @template S,T
*/
LayerRenderer.prototype.forEachFeatureAtCoordinate = nullFunction;
LayerRenderer.prototype.forEachFeatureAtCoordinate = UNDEFINED;
/**
+3 -3
View File
@@ -1,12 +1,12 @@
/**
* @module ol/renderer/Map
*/
import {getUid, inherits, nullFunction} from '../index.js';
import {getUid, inherits} from '../index.js';
import Disposable from '../Disposable.js';
import {listen, unlistenByKey} from '../events.js';
import EventType from '../events/EventType.js';
import {getWidth} from '../extent.js';
import {TRUE} from '../functions.js';
import {TRUE, UNDEFINED} from '../functions.js';
import {visibleAtResolution} from '../layer/Layer.js';
import {getLayerRendererPlugins} from '../plugins.js';
import {iconImageCache} from '../style.js';
@@ -289,7 +289,7 @@ MapRenderer.prototype.removeLayerRendererByKey_ = function(layerKey) {
* Render.
* @param {?olx.FrameState} frameState Frame state.
*/
MapRenderer.prototype.renderFrame = nullFunction;
MapRenderer.prototype.renderFrame = UNDEFINED;
/**
+3 -2
View File
@@ -1,10 +1,11 @@
/**
* @module ol/renderer/canvas/IntermediateCanvas
*/
import {inherits, nullFunction} from '../../index.js';
import {inherits} from '../../index.js';
import {scale as scaleCoordinate} from '../../coordinate.js';
import {createCanvasContext2D} from '../../dom.js';
import {containsExtent, intersects} from '../../extent.js';
import {UNDEFINED} from '../../functions.js';
import CanvasLayerRenderer from '../canvas/Layer.js';
import {create as createTransform, apply as applyTransform} from '../../transform.js';
@@ -123,7 +124,7 @@ IntermediateCanvasRenderer.prototype.forEachLayerAtCoordinate = function(coordin
return undefined;
}
if (this.getLayer().getSource().forEachFeatureAtCoordinate !== nullFunction) {
if (this.getLayer().getSource().forEachFeatureAtCoordinate !== UNDEFINED) {
// for ImageCanvas sources use the original hit-detection logic,
// so that for example also transparent polygons are detected
return CanvasLayerRenderer.prototype.forEachLayerAtCoordinate.apply(this, arguments);
+3 -2
View File
@@ -2,7 +2,8 @@
* @module ol/renderer/webgl/ImageLayer
*/
import {ENABLE_RASTER_REPROJECTION} from '../../reproj/common.js';
import {inherits, nullFunction} from '../../index.js';
import {inherits} from '../../index.js';
import {UNDEFINED} from '../../functions.js';
import LayerType from '../../LayerType.js';
import ViewHint from '../../ViewHint.js';
import {createCanvasContext2D} from '../../dom.js';
@@ -254,7 +255,7 @@ WebGLImageLayerRenderer.prototype.forEachLayerAtPixel = function(pixel, frameSta
return undefined;
}
if (this.getLayer().getSource().forEachFeatureAtCoordinate !== nullFunction) {
if (this.getLayer().getSource().forEachFeatureAtCoordinate !== UNDEFINED) {
// for ImageCanvas sources use the original hit-detection logic,
// so that for example also transparent polygons are detected
const coordinate = applyTransform(