Get rid of goog.functions

This commit is contained in:
Björn Harrtell
2016-03-20 19:39:00 +01:00
parent baf5287ad2
commit 44e04be67f
23 changed files with 91 additions and 56 deletions

View File

@@ -2,7 +2,7 @@ goog.provide('ol.events.ConditionType');
goog.provide('ol.events.condition'); goog.provide('ol.events.condition');
goog.require('goog.asserts'); goog.require('goog.asserts');
goog.require('goog.functions'); goog.require('ol.functions');
goog.require('ol.MapBrowserEvent.EventType'); goog.require('ol.MapBrowserEvent.EventType');
goog.require('ol.MapBrowserPointerEvent'); goog.require('ol.MapBrowserPointerEvent');
@@ -59,7 +59,7 @@ ol.events.condition.altShiftKeysOnly = function(mapBrowserEvent) {
* @function * @function
* @api stable * @api stable
*/ */
ol.events.condition.always = goog.functions.TRUE; ol.events.condition.always = ol.functions.TRUE;
/** /**
@@ -98,7 +98,7 @@ ol.events.condition.mouseActionButton = function(mapBrowserEvent) {
* @function * @function
* @api stable * @api stable
*/ */
ol.events.condition.never = goog.functions.FALSE; ol.events.condition.never = ol.functions.FALSE;
/** /**

17
src/ol/functions.js Normal file
View File

@@ -0,0 +1,17 @@
goog.provide('ol.functions');
/**
* Always returns true.
* @returns {boolean} true.
*/
ol.functions.TRUE = function() {
return true;
};
/**
* Always returns false.
* @returns {boolean} false.
*/
ol.functions.FALSE = function() {
return false;
};

View File

@@ -3,7 +3,7 @@ goog.provide('ol.geom.GeometryLayout');
goog.provide('ol.geom.GeometryType'); goog.provide('ol.geom.GeometryType');
goog.require('goog.asserts'); goog.require('goog.asserts');
goog.require('goog.functions'); goog.require('ol.functions');
goog.require('ol.Object'); goog.require('ol.Object');
goog.require('ol.extent'); goog.require('ol.extent');
goog.require('ol.proj'); goog.require('ol.proj');
@@ -151,7 +151,7 @@ ol.geom.Geometry.prototype.computeExtent = goog.abstractMethod;
* @param {number} y Y. * @param {number} y Y.
* @return {boolean} Contains (x, y). * @return {boolean} Contains (x, y).
*/ */
ol.geom.Geometry.prototype.containsXY = goog.functions.FALSE; ol.geom.Geometry.prototype.containsXY = ol.functions.FALSE;
/** /**

View File

@@ -1,7 +1,7 @@
goog.provide('ol.geom.SimpleGeometry'); goog.provide('ol.geom.SimpleGeometry');
goog.require('goog.asserts'); goog.require('goog.asserts');
goog.require('goog.functions'); goog.require('ol.functions');
goog.require('ol.extent'); goog.require('ol.extent');
goog.require('ol.geom.Geometry'); goog.require('ol.geom.Geometry');
goog.require('ol.geom.GeometryLayout'); goog.require('ol.geom.GeometryLayout');
@@ -84,7 +84,7 @@ ol.geom.SimpleGeometry.getStrideForLayout = function(layout) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
ol.geom.SimpleGeometry.prototype.containsXY = goog.functions.FALSE; ol.geom.SimpleGeometry.prototype.containsXY = ol.functions.FALSE;
/** /**

View File

@@ -4,7 +4,7 @@ goog.provide('ol.interaction.DragAndDrop');
goog.provide('ol.interaction.DragAndDropEvent'); goog.provide('ol.interaction.DragAndDropEvent');
goog.require('goog.asserts'); goog.require('goog.asserts');
goog.require('goog.functions'); goog.require('ol.functions');
goog.require('ol.events'); goog.require('ol.events');
goog.require('ol.events.Event'); goog.require('ol.events.Event');
goog.require('ol.events.EventType'); goog.require('ol.events.EventType');
@@ -134,7 +134,7 @@ ol.interaction.DragAndDrop.prototype.handleResult_ = function(file, event) {
* @this {ol.interaction.DragAndDrop} * @this {ol.interaction.DragAndDrop}
* @api * @api
*/ */
ol.interaction.DragAndDrop.handleEvent = goog.functions.TRUE; ol.interaction.DragAndDrop.handleEvent = ol.functions.TRUE;
/** /**

View File

@@ -6,6 +6,7 @@ goog.require('ol.Pixel');
goog.require('ol.PreRenderFunction'); goog.require('ol.PreRenderFunction');
goog.require('ol.ViewHint'); goog.require('ol.ViewHint');
goog.require('ol.coordinate'); goog.require('ol.coordinate');
goog.require('ol.functions');
goog.require('ol.events.condition'); goog.require('ol.events.condition');
goog.require('ol.interaction.Pointer'); goog.require('ol.interaction.Pointer');
@@ -165,4 +166,4 @@ ol.interaction.DragPan.handleDownEvent_ = function(mapBrowserEvent) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
ol.interaction.DragPan.prototype.shouldStopEvent = goog.functions.FALSE; ol.interaction.DragPan.prototype.shouldStopEvent = ol.functions.FALSE;

View File

@@ -2,6 +2,7 @@ goog.provide('ol.interaction.DragRotate');
goog.require('ol'); goog.require('ol');
goog.require('ol.ViewHint'); goog.require('ol.ViewHint');
goog.require('ol.functions');
goog.require('ol.events.ConditionType'); goog.require('ol.events.ConditionType');
goog.require('ol.events.condition'); goog.require('ol.events.condition');
goog.require('ol.interaction.Interaction'); goog.require('ol.interaction.Interaction');
@@ -128,4 +129,4 @@ ol.interaction.DragRotate.handleDownEvent_ = function(mapBrowserEvent) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
ol.interaction.DragRotate.prototype.shouldStopEvent = goog.functions.FALSE; ol.interaction.DragRotate.prototype.shouldStopEvent = ol.functions.FALSE;

View File

@@ -14,6 +14,7 @@ goog.require('ol.MapBrowserEvent');
goog.require('ol.MapBrowserEvent.EventType'); goog.require('ol.MapBrowserEvent.EventType');
goog.require('ol.Object'); goog.require('ol.Object');
goog.require('ol.coordinate'); goog.require('ol.coordinate');
goog.require('ol.functions');
goog.require('ol.events.condition'); goog.require('ol.events.condition');
goog.require('ol.geom.Circle'); goog.require('ol.geom.Circle');
goog.require('ol.geom.GeometryType'); goog.require('ol.geom.GeometryType');
@@ -741,7 +742,7 @@ ol.interaction.Draw.prototype.extend = function(feature) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
ol.interaction.Draw.prototype.shouldStopEvent = goog.functions.FALSE; ol.interaction.Draw.prototype.shouldStopEvent = ol.functions.FALSE;
/** /**

View File

@@ -1,7 +1,6 @@
goog.provide('ol.interaction.KeyboardPan'); goog.provide('ol.interaction.KeyboardPan');
goog.require('goog.asserts'); goog.require('goog.asserts');
goog.require('goog.functions');
goog.require('ol'); goog.require('ol');
goog.require('ol.coordinate'); goog.require('ol.coordinate');
goog.require('ol.events.ConditionType'); goog.require('ol.events.ConditionType');
@@ -36,14 +35,22 @@ ol.interaction.KeyboardPan = function(opt_options) {
var options = opt_options || {}; var options = opt_options || {};
/**
* @private
* @param {ol.MapBrowserEvent} mapBrowserEvent Browser event.
* @return {boolean} Combined condition result.
*/
this.defaultCondition_ = function(mapBrowserEvent) {
return ol.events.condition.noModifierKeys.call(this, mapBrowserEvent) &&
ol.events.condition.targetNotEditable.call(this, mapBrowserEvent)
}
/** /**
* @private * @private
* @type {ol.events.ConditionType} * @type {ol.events.ConditionType}
*/ */
this.condition_ = options.condition !== undefined ? this.condition_ = options.condition !== undefined ?
options.condition : options.condition : this.defaultCondition_
goog.functions.and(ol.events.condition.noModifierKeys,
ol.events.condition.targetNotEditable);
/** /**
* @private * @private
@@ -61,7 +68,6 @@ ol.interaction.KeyboardPan = function(opt_options) {
}; };
goog.inherits(ol.interaction.KeyboardPan, ol.interaction.Interaction); goog.inherits(ol.interaction.KeyboardPan, ol.interaction.Interaction);
/** /**
* Handles the {@link ol.MapBrowserEvent map browser event} if it was a * Handles the {@link ol.MapBrowserEvent map browser event} if it was a
* `KeyEvent`, and decides the direction to pan to (if an arrow key was * `KeyEvent`, and decides the direction to pan to (if an arrow key was

View File

@@ -1,9 +1,9 @@
goog.provide('ol.interaction.PinchRotate'); goog.provide('ol.interaction.PinchRotate');
goog.require('goog.asserts'); goog.require('goog.asserts');
goog.require('goog.functions');
goog.require('ol'); goog.require('ol');
goog.require('ol.Coordinate'); goog.require('ol.Coordinate');
goog.require('ol.functions');
goog.require('ol.ViewHint'); goog.require('ol.ViewHint');
goog.require('ol.interaction.Interaction'); goog.require('ol.interaction.Interaction');
goog.require('ol.interaction.Pointer'); goog.require('ol.interaction.Pointer');
@@ -170,4 +170,4 @@ ol.interaction.PinchRotate.handleDownEvent_ = function(mapBrowserEvent) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
ol.interaction.PinchRotate.prototype.shouldStopEvent = goog.functions.FALSE; ol.interaction.PinchRotate.prototype.shouldStopEvent = ol.functions.FALSE;

View File

@@ -1,9 +1,9 @@
goog.provide('ol.interaction.PinchZoom'); goog.provide('ol.interaction.PinchZoom');
goog.require('goog.asserts'); goog.require('goog.asserts');
goog.require('goog.functions');
goog.require('ol'); goog.require('ol');
goog.require('ol.Coordinate'); goog.require('ol.Coordinate');
goog.require('ol.functions');
goog.require('ol.ViewHint'); goog.require('ol.ViewHint');
goog.require('ol.interaction.Interaction'); goog.require('ol.interaction.Interaction');
goog.require('ol.interaction.Pointer'); goog.require('ol.interaction.Pointer');
@@ -153,4 +153,4 @@ ol.interaction.PinchZoom.handleDownEvent_ = function(mapBrowserEvent) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
ol.interaction.PinchZoom.prototype.shouldStopEvent = goog.functions.FALSE; ol.interaction.PinchZoom.prototype.shouldStopEvent = ol.functions.FALSE;

View File

@@ -1,6 +1,5 @@
goog.provide('ol.interaction.Pointer'); goog.provide('ol.interaction.Pointer');
goog.require('goog.functions');
goog.require('ol'); goog.require('ol');
goog.require('ol.MapBrowserEvent.EventType'); goog.require('ol.MapBrowserEvent.EventType');
goog.require('ol.MapBrowserPointerEvent'); goog.require('ol.MapBrowserPointerEvent');
@@ -150,7 +149,7 @@ ol.interaction.Pointer.handleDragEvent = ol.nullFunction;
* @return {boolean} Capture dragging. * @return {boolean} Capture dragging.
* @this {ol.interaction.Pointer} * @this {ol.interaction.Pointer}
*/ */
ol.interaction.Pointer.handleUpEvent = goog.functions.FALSE; ol.interaction.Pointer.handleUpEvent = ol.functions.FALSE;
/** /**
@@ -158,7 +157,7 @@ ol.interaction.Pointer.handleUpEvent = goog.functions.FALSE;
* @return {boolean} Capture dragging. * @return {boolean} Capture dragging.
* @this {ol.interaction.Pointer} * @this {ol.interaction.Pointer}
*/ */
ol.interaction.Pointer.handleDownEvent = goog.functions.FALSE; ol.interaction.Pointer.handleDownEvent = ol.functions.FALSE;
/** /**
@@ -215,4 +214,6 @@ ol.interaction.Pointer.handleEvent = function(mapBrowserEvent) {
* @return {boolean} Should the event be stopped? * @return {boolean} Should the event be stopped?
* @protected * @protected
*/ */
ol.interaction.Pointer.prototype.shouldStopEvent = goog.functions.identity; ol.interaction.Pointer.prototype.shouldStopEvent = function(handled) {
return handled;
};

View File

@@ -4,7 +4,7 @@ goog.provide('ol.interaction.SelectEventType');
goog.provide('ol.interaction.SelectFilterFunction'); goog.provide('ol.interaction.SelectFilterFunction');
goog.require('goog.asserts'); goog.require('goog.asserts');
goog.require('goog.functions'); goog.require('ol.functions');
goog.require('ol.CollectionEventType'); goog.require('ol.CollectionEventType');
goog.require('ol.Feature'); goog.require('ol.Feature');
goog.require('ol.array'); goog.require('ol.array');
@@ -148,7 +148,7 @@ ol.interaction.Select = function(opt_options) {
* @type {ol.interaction.SelectFilterFunction} * @type {ol.interaction.SelectFilterFunction}
*/ */
this.filter_ = options.filter ? options.filter : this.filter_ = options.filter ? options.filter :
goog.functions.TRUE; ol.functions.TRUE;
var featureOverlay = new ol.layer.Vector({ var featureOverlay = new ol.layer.Vector({
source: new ol.source.Vector({ source: new ol.source.Vector({
@@ -190,7 +190,7 @@ ol.interaction.Select = function(opt_options) {
}; };
} }
} else { } else {
layerFilter = goog.functions.TRUE; layerFilter = ol.functions.TRUE;
} }
/** /**

View File

@@ -16,6 +16,7 @@ goog.require('ol.events.EventType');
goog.require('ol.extent'); goog.require('ol.extent');
goog.require('ol.geom.Geometry'); goog.require('ol.geom.Geometry');
goog.require('ol.interaction.Pointer'); goog.require('ol.interaction.Pointer');
goog.require('ol.functions');
goog.require('ol.object'); goog.require('ol.object');
goog.require('ol.source.Vector'); goog.require('ol.source.Vector');
goog.require('ol.source.VectorEvent'); goog.require('ol.source.VectorEvent');
@@ -49,7 +50,7 @@ ol.interaction.Snap = function(opt_options) {
goog.base(this, { goog.base(this, {
handleEvent: ol.interaction.Snap.handleEvent_, handleEvent: ol.interaction.Snap.handleEvent_,
handleDownEvent: goog.functions.TRUE, handleDownEvent: ol.functions.TRUE,
handleUpEvent: ol.interaction.Snap.handleUpEvent_ handleUpEvent: ol.interaction.Snap.handleUpEvent_
}); });
@@ -364,7 +365,7 @@ ol.interaction.Snap.prototype.setMap = function(map) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
ol.interaction.Snap.prototype.shouldStopEvent = goog.functions.FALSE; ol.interaction.Snap.prototype.shouldStopEvent = ol.functions.FALSE;
/** /**

View File

@@ -8,7 +8,6 @@ goog.provide('ol.MapProperty');
goog.require('goog.asserts'); goog.require('goog.asserts');
goog.require('goog.async.nextTick'); goog.require('goog.async.nextTick');
goog.require('goog.dom'); goog.require('goog.dom');
goog.require('goog.functions');
goog.require('goog.style'); goog.require('goog.style');
goog.require('goog.vec.Mat4'); goog.require('goog.vec.Mat4');
goog.require('ol.Collection'); goog.require('ol.Collection');
@@ -35,6 +34,7 @@ goog.require('ol.events');
goog.require('ol.events.Event'); goog.require('ol.events.Event');
goog.require('ol.events.EventType'); goog.require('ol.events.EventType');
goog.require('ol.extent'); goog.require('ol.extent');
goog.require('ol.functions');
goog.require('ol.has'); goog.require('ol.has');
goog.require('ol.interaction'); goog.require('ol.interaction');
goog.require('ol.layer.Base'); goog.require('ol.layer.Base');
@@ -624,7 +624,7 @@ ol.Map.prototype.forEachFeatureAtPixel = function(pixel, callback, opt_this, opt
var coordinate = this.getCoordinateFromPixel(pixel); var coordinate = this.getCoordinateFromPixel(pixel);
var thisArg = opt_this !== undefined ? opt_this : null; var thisArg = opt_this !== undefined ? opt_this : null;
var layerFilter = opt_layerFilter !== undefined ? var layerFilter = opt_layerFilter !== undefined ?
opt_layerFilter : goog.functions.TRUE; opt_layerFilter : ol.functions.TRUE;
var thisArg2 = opt_this2 !== undefined ? opt_this2 : null; var thisArg2 = opt_this2 !== undefined ? opt_this2 : null;
return this.renderer_.forEachFeatureAtCoordinate( return this.renderer_.forEachFeatureAtCoordinate(
coordinate, this.frameState_, callback, thisArg, coordinate, this.frameState_, callback, thisArg,
@@ -660,7 +660,7 @@ ol.Map.prototype.forEachLayerAtPixel = function(pixel, callback, opt_this, opt_l
} }
var thisArg = opt_this !== undefined ? opt_this : null; var thisArg = opt_this !== undefined ? opt_this : null;
var layerFilter = opt_layerFilter !== undefined ? var layerFilter = opt_layerFilter !== undefined ?
opt_layerFilter : goog.functions.TRUE; opt_layerFilter : ol.functions.TRUE;
var thisArg2 = opt_this2 !== undefined ? opt_this2 : null; var thisArg2 = opt_this2 !== undefined ? opt_this2 : null;
return this.renderer_.forEachLayerAtPixel( return this.renderer_.forEachLayerAtPixel(
pixel, this.frameState_, callback, thisArg, pixel, this.frameState_, callback, thisArg,
@@ -689,7 +689,7 @@ ol.Map.prototype.hasFeatureAtPixel = function(pixel, opt_layerFilter, opt_this)
} }
var coordinate = this.getCoordinateFromPixel(pixel); var coordinate = this.getCoordinateFromPixel(pixel);
var layerFilter = opt_layerFilter !== undefined ? var layerFilter = opt_layerFilter !== undefined ?
opt_layerFilter : goog.functions.TRUE; opt_layerFilter : ol.functions.TRUE;
var thisArg = opt_this !== undefined ? opt_this : null; var thisArg = opt_this !== undefined ? opt_this : null;
return this.renderer_.hasFeatureAtCoordinate( return this.renderer_.hasFeatureAtCoordinate(
coordinate, this.frameState_, layerFilter, thisArg); coordinate, this.frameState_, layerFilter, thisArg);

View File

@@ -2,7 +2,6 @@ goog.provide('ol.render.webgl.ImageReplay');
goog.provide('ol.render.webgl.ReplayGroup'); goog.provide('ol.render.webgl.ReplayGroup');
goog.require('goog.asserts'); goog.require('goog.asserts');
goog.require('goog.functions');
goog.require('goog.vec.Mat4'); goog.require('goog.vec.Mat4');
goog.require('ol.extent'); goog.require('ol.extent');
goog.require('ol.object'); goog.require('ol.object');
@@ -954,7 +953,14 @@ ol.render.webgl.ReplayGroup.prototype.getDeleteResourcesFunction = function(cont
functions.push( functions.push(
this.replays_[replayKey].getDeleteResourcesFunction(context)); this.replays_[replayKey].getDeleteResourcesFunction(context));
} }
return goog.functions.sequence.apply(null, functions); return function() {
var length = functions.length;
var result;
for (var i = 0; i < length; i++) {
result = functions[i].apply(this, arguments);
}
return result;
};
}; };

View File

@@ -1,8 +1,8 @@
goog.provide('ol.renderer.canvas.ImageLayer'); goog.provide('ol.renderer.canvas.ImageLayer');
goog.require('goog.asserts'); goog.require('goog.asserts');
goog.require('goog.functions');
goog.require('goog.vec.Mat4'); goog.require('goog.vec.Mat4');
goog.require('ol.functions');
goog.require('ol.ImageBase'); goog.require('ol.ImageBase');
goog.require('ol.ViewHint'); goog.require('ol.ViewHint');
goog.require('ol.dom'); goog.require('ol.dom');
@@ -87,7 +87,7 @@ ol.renderer.canvas.ImageLayer.prototype.forEachLayerAtPixel = function(pixel, fr
ol.vec.Mat4.multVec2( ol.vec.Mat4.multVec2(
frameState.pixelToCoordinateMatrix, coordinate, coordinate); frameState.pixelToCoordinateMatrix, coordinate, coordinate);
var hasFeature = this.forEachFeatureAtCoordinate( var hasFeature = this.forEachFeatureAtCoordinate(
coordinate, frameState, goog.functions.TRUE, this); coordinate, frameState, ol.functions.TRUE, this);
if (hasFeature) { if (hasFeature) {
return callback.call(thisArg, this.getLayer()); return callback.call(thisArg, this.getLayer());

View File

@@ -3,8 +3,8 @@ goog.provide('ol.renderer.Layer');
goog.require('goog.asserts'); goog.require('goog.asserts');
goog.require('ol.events'); goog.require('ol.events');
goog.require('ol.events.EventType'); goog.require('ol.events.EventType');
goog.require('goog.functions');
goog.require('ol'); goog.require('ol');
goog.require('ol.functions');
goog.require('ol.ImageState'); goog.require('ol.ImageState');
goog.require('ol.Observable'); goog.require('ol.Observable');
goog.require('ol.TileRange'); goog.require('ol.TileRange');
@@ -63,7 +63,7 @@ ol.renderer.Layer.prototype.forEachLayerAtPixel = function(pixel, frameState, ca
frameState.pixelToCoordinateMatrix, coordinate, coordinate); frameState.pixelToCoordinateMatrix, coordinate, coordinate);
var hasFeature = this.forEachFeatureAtCoordinate( var hasFeature = this.forEachFeatureAtCoordinate(
coordinate, frameState, goog.functions.TRUE, this); coordinate, frameState, ol.functions.TRUE, this);
if (hasFeature) { if (hasFeature) {
return callback.call(thisArg, this.layer_); return callback.call(thisArg, this.layer_);
@@ -78,7 +78,7 @@ ol.renderer.Layer.prototype.forEachLayerAtPixel = function(pixel, frameState, ca
* @param {olx.FrameState} frameState Frame state. * @param {olx.FrameState} frameState Frame state.
* @return {boolean} Is there a feature at the given coordinate? * @return {boolean} Is there a feature at the given coordinate?
*/ */
ol.renderer.Layer.prototype.hasFeatureAtCoordinate = goog.functions.FALSE; ol.renderer.Layer.prototype.hasFeatureAtCoordinate = ol.functions.FALSE;
/** /**

View File

@@ -2,13 +2,13 @@ goog.provide('ol.RendererType');
goog.provide('ol.renderer.Map'); goog.provide('ol.renderer.Map');
goog.require('goog.asserts'); goog.require('goog.asserts');
goog.require('goog.functions');
goog.require('goog.vec.Mat4'); goog.require('goog.vec.Mat4');
goog.require('ol'); goog.require('ol');
goog.require('ol.Disposable'); goog.require('ol.Disposable');
goog.require('ol.events'); goog.require('ol.events');
goog.require('ol.events.EventType'); goog.require('ol.events.EventType');
goog.require('ol.extent'); goog.require('ol.extent');
goog.require('ol.functions');
goog.require('ol.layer.Layer'); goog.require('ol.layer.Layer');
goog.require('ol.renderer.Layer'); goog.require('ol.renderer.Layer');
goog.require('ol.style.IconImageCache'); goog.require('ol.style.IconImageCache');
@@ -232,7 +232,7 @@ ol.renderer.Map.prototype.forEachLayerAtPixel = function(pixel, frameState, call
*/ */
ol.renderer.Map.prototype.hasFeatureAtCoordinate = function(coordinate, frameState, layerFilter, thisArg) { ol.renderer.Map.prototype.hasFeatureAtCoordinate = function(coordinate, frameState, layerFilter, thisArg) {
var hasFeature = this.forEachFeatureAtCoordinate( var hasFeature = this.forEachFeatureAtCoordinate(
coordinate, frameState, goog.functions.TRUE, this, layerFilter, thisArg); coordinate, frameState, ol.functions.TRUE, this, layerFilter, thisArg);
return hasFeature !== undefined; return hasFeature !== undefined;
}; };

View File

@@ -1,7 +1,6 @@
goog.provide('ol.renderer.webgl.ImageLayer'); goog.provide('ol.renderer.webgl.ImageLayer');
goog.require('goog.asserts'); goog.require('goog.asserts');
goog.require('goog.functions');
goog.require('goog.vec.Mat4'); goog.require('goog.vec.Mat4');
goog.require('goog.webgl'); goog.require('goog.webgl');
goog.require('ol.Coordinate'); goog.require('ol.Coordinate');
@@ -10,6 +9,7 @@ goog.require('ol.ImageBase');
goog.require('ol.ViewHint'); goog.require('ol.ViewHint');
goog.require('ol.dom'); goog.require('ol.dom');
goog.require('ol.extent'); goog.require('ol.extent');
goog.require('ol.functions');
goog.require('ol.layer.Image'); goog.require('ol.layer.Image');
goog.require('ol.proj'); goog.require('ol.proj');
goog.require('ol.renderer.webgl.Layer'); goog.require('ol.renderer.webgl.Layer');
@@ -221,7 +221,7 @@ ol.renderer.webgl.ImageLayer.prototype.updateProjectionMatrix_ = function(canvas
*/ */
ol.renderer.webgl.ImageLayer.prototype.hasFeatureAtCoordinate = function(coordinate, frameState) { ol.renderer.webgl.ImageLayer.prototype.hasFeatureAtCoordinate = function(coordinate, frameState) {
var hasFeature = this.forEachFeatureAtCoordinate( var hasFeature = this.forEachFeatureAtCoordinate(
coordinate, frameState, goog.functions.TRUE, this); coordinate, frameState, ol.functions.TRUE, this);
return hasFeature !== undefined; return hasFeature !== undefined;
}; };
@@ -241,7 +241,7 @@ ol.renderer.webgl.ImageLayer.prototype.forEachLayerAtPixel = function(pixel, fra
ol.vec.Mat4.multVec2( ol.vec.Mat4.multVec2(
frameState.pixelToCoordinateMatrix, coordinate, coordinate); frameState.pixelToCoordinateMatrix, coordinate, coordinate);
var hasFeature = this.forEachFeatureAtCoordinate( var hasFeature = this.forEachFeatureAtCoordinate(
coordinate, frameState, goog.functions.TRUE, this); coordinate, frameState, ol.functions.TRUE, this);
if (hasFeature) { if (hasFeature) {
return callback.call(thisArg, this.getLayer()); return callback.call(thisArg, this.getLayer());

View File

@@ -2,10 +2,8 @@ goog.provide('ol.style.Atlas');
goog.provide('ol.style.AtlasManager'); goog.provide('ol.style.AtlasManager');
goog.require('goog.asserts'); goog.require('goog.asserts');
goog.require('goog.functions');
goog.require('ol'); goog.require('ol');
/** /**
* Provides information for an image inside an atlas manager. * Provides information for an image inside an atlas manager.
* `offsetX` and `offsetY` is the position of the image inside * `offsetX` and `offsetY` is the position of the image inside
@@ -186,7 +184,7 @@ ol.style.AtlasManager.prototype.add = function(id, width, height,
// the hit-detection atlas, to make sure that the offset is the same for // the hit-detection atlas, to make sure that the offset is the same for
// the original image and the hit-detection image. // the original image and the hit-detection image.
var renderHitCallback = opt_renderHitCallback !== undefined ? var renderHitCallback = opt_renderHitCallback !== undefined ?
opt_renderHitCallback : goog.functions.NULL; opt_renderHitCallback : ol.nullFunction
/** @type {?ol.style.AtlasInfo} */ /** @type {?ol.style.AtlasInfo} */
var hitInfo = this.add_(true, var hitInfo = this.add_(true,

View File

@@ -3,8 +3,8 @@ goog.provide('ol.webgl.Shader');
goog.provide('ol.webgl.Vertex'); goog.provide('ol.webgl.Vertex');
goog.provide('ol.webgl.shader'); goog.provide('ol.webgl.shader');
goog.require('goog.functions');
goog.require('goog.webgl'); goog.require('goog.webgl');
goog.require('ol.functions');
goog.require('ol.webgl'); goog.require('ol.webgl');
@@ -41,7 +41,7 @@ ol.webgl.Shader.prototype.getSource = function() {
/** /**
* @return {boolean} Is animated? * @return {boolean} Is animated?
*/ */
ol.webgl.Shader.prototype.isAnimated = goog.functions.FALSE; ol.webgl.Shader.prototype.isAnimated = ol.functions.FALSE;
/** /**

View File

@@ -3,12 +3,16 @@ goog.provide('ol.test.structs.PriorityQueue');
describe('ol.structs.PriorityQueue', function() { describe('ol.structs.PriorityQueue', function() {
var identity = function(a) {
return a;
}
describe('when empty', function() { describe('when empty', function() {
var pq; var pq;
beforeEach(function() { beforeEach(function() {
pq = new ol.structs.PriorityQueue( pq = new ol.structs.PriorityQueue(
goog.functions.identity, goog.functions.identity); identity, identity);
}); });
it('is valid', function() { it('is valid', function() {
@@ -65,7 +69,7 @@ describe('ol.structs.PriorityQueue', function() {
beforeEach(function() { beforeEach(function() {
elements = []; elements = [];
pq = new ol.structs.PriorityQueue( pq = new ol.structs.PriorityQueue(
goog.functions.identity, goog.functions.identity); identity, identity);
var element, i; var element, i;
for (i = 0; i < 32; ++i) { for (i = 0; i < 32; ++i) {
element = Math.random(); element = Math.random();
@@ -92,7 +96,7 @@ describe('ol.structs.PriorityQueue', function() {
target = 0.5; target = 0.5;
pq = new ol.structs.PriorityQueue(function(element) { pq = new ol.structs.PriorityQueue(function(element) {
return Math.abs(element - target); return Math.abs(element - target);
}, goog.functions.identity); }, identity);
var i; var i;
for (i = 0; i < 32; ++i) { for (i = 0; i < 32; ++i) {
pq.enqueue(Math.random()); pq.enqueue(Math.random());
@@ -149,7 +153,7 @@ describe('ol.structs.PriorityQueue', function() {
var pq; var pq;
beforeEach(function() { beforeEach(function() {
pq = new ol.structs.PriorityQueue( pq = new ol.structs.PriorityQueue(
goog.functions.identity, goog.functions.identity); identity, identity);
pq.enqueue('a'); pq.enqueue('a');
pq.enqueue('b'); pq.enqueue('b');
pq.enqueue('c'); pq.enqueue('c');
@@ -194,5 +198,4 @@ describe('ol.structs.PriorityQueue', function() {
}); });
goog.require('goog.functions');
goog.require('ol.structs.PriorityQueue'); goog.require('ol.structs.PriorityQueue');