Remove use of goog.partial
Use Function.prototype.bind instead, see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind#Partially_applied_functions_(currying)
This commit is contained in:
@@ -42,9 +42,8 @@ ol.control.Zoom = function(opt_options) {
|
||||
'title': zoomInTipLabel
|
||||
}, zoomInLabel);
|
||||
|
||||
ol.events.listen(inElement,
|
||||
ol.events.EventType.CLICK, goog.partial(
|
||||
ol.control.Zoom.prototype.handleClick_, delta), this);
|
||||
ol.events.listen(inElement, ol.events.EventType.CLICK,
|
||||
ol.control.Zoom.prototype.handleClick_.bind(this, delta));
|
||||
|
||||
var outElement = goog.dom.createDom('BUTTON', {
|
||||
'class': className + '-out',
|
||||
@@ -52,9 +51,8 @@ ol.control.Zoom = function(opt_options) {
|
||||
'title': zoomOutTipLabel
|
||||
}, zoomOutLabel);
|
||||
|
||||
ol.events.listen(outElement,
|
||||
ol.events.EventType.CLICK, goog.partial(
|
||||
ol.control.Zoom.prototype.handleClick_, -delta), this);
|
||||
ol.events.listen(outElement, ol.events.EventType.CLICK,
|
||||
ol.control.Zoom.prototype.handleClick_.bind(this, -delta));
|
||||
|
||||
var cssClasses = className + ' ' + ol.css.CLASS_UNSELECTABLE + ' ' +
|
||||
ol.css.CLASS_CONTROL;
|
||||
|
||||
@@ -72,7 +72,7 @@ ol.interaction.DragAndDrop.handleDrop_ = function(event) {
|
||||
file = files.item(i);
|
||||
var reader = new FileReader();
|
||||
reader.addEventListener(ol.events.EventType.LOAD,
|
||||
goog.partial(this.handleResult_, file).bind(this));
|
||||
this.handleResult_.bind(this, file));
|
||||
reader.readAsText(file);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -181,18 +181,20 @@ ol.renderer.Layer.prototype.renderIfReadyAndVisible = function() {
|
||||
*/
|
||||
ol.renderer.Layer.prototype.scheduleExpireCache = function(frameState, tileSource) {
|
||||
if (tileSource.canExpireCache()) {
|
||||
/**
|
||||
* @param {ol.source.Tile} tileSource Tile source.
|
||||
* @param {ol.Map} map Map.
|
||||
* @param {olx.FrameState} frameState Frame state.
|
||||
*/
|
||||
var postRenderFunction = function(tileSource, map, frameState) {
|
||||
var tileSourceKey = goog.getUid(tileSource).toString();
|
||||
tileSource.expireCache(frameState.viewState.projection,
|
||||
frameState.usedTiles[tileSourceKey]);
|
||||
}.bind(null, tileSource);
|
||||
|
||||
frameState.postRenderFunctions.push(
|
||||
/** @type {ol.PostRenderFunction} */ (goog.partial(
|
||||
/**
|
||||
* @param {ol.source.Tile} tileSource Tile source.
|
||||
* @param {ol.Map} map Map.
|
||||
* @param {olx.FrameState} frameState Frame state.
|
||||
*/
|
||||
function(tileSource, map, frameState) {
|
||||
var tileSourceKey = goog.getUid(tileSource).toString();
|
||||
tileSource.expireCache(frameState.viewState.projection,
|
||||
frameState.usedTiles[tileSourceKey]);
|
||||
}, tileSource)));
|
||||
/** @type {ol.PostRenderFunction} */ (postRenderFunction)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -138,17 +138,18 @@ ol.renderer.webgl.ImageLayer.prototype.prepareFrame = function(frameState, layer
|
||||
image = image_;
|
||||
texture = this.createTexture_(image_);
|
||||
if (this.texture) {
|
||||
/**
|
||||
* @param {WebGLRenderingContext} gl GL.
|
||||
* @param {WebGLTexture} texture Texture.
|
||||
*/
|
||||
var postRenderFunction = function(gl, texture) {
|
||||
if (!gl.isContextLost()) {
|
||||
gl.deleteTexture(texture);
|
||||
}
|
||||
}.bind(null, gl, this.texture);
|
||||
frameState.postRenderFunctions.push(
|
||||
/** @type {ol.PostRenderFunction} */ (goog.partial(
|
||||
/**
|
||||
* @param {WebGLRenderingContext} gl GL.
|
||||
* @param {WebGLTexture} texture Texture.
|
||||
*/
|
||||
function(gl, texture) {
|
||||
if (!gl.isContextLost()) {
|
||||
gl.deleteTexture(texture);
|
||||
}
|
||||
}, gl, this.texture)));
|
||||
/** @type {ol.PostRenderFunction} */ (postRenderFunction)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,20 +93,21 @@ ol.renderer.webgl.Layer.prototype.bindFramebuffer = function(frameState, framebu
|
||||
|
||||
if (this.framebufferDimension === undefined ||
|
||||
this.framebufferDimension != framebufferDimension) {
|
||||
/**
|
||||
* @param {WebGLRenderingContext} gl GL.
|
||||
* @param {WebGLFramebuffer} framebuffer Framebuffer.
|
||||
* @param {WebGLTexture} texture Texture.
|
||||
*/
|
||||
var postRenderFunction = function(gl, framebuffer, texture) {
|
||||
if (!gl.isContextLost()) {
|
||||
gl.deleteFramebuffer(framebuffer);
|
||||
gl.deleteTexture(texture);
|
||||
}
|
||||
}.bind(null, gl, this.framebuffer, this.texture);
|
||||
|
||||
frameState.postRenderFunctions.push(
|
||||
/** @type {ol.PostRenderFunction} */ (goog.partial(
|
||||
/**
|
||||
* @param {WebGLRenderingContext} gl GL.
|
||||
* @param {WebGLFramebuffer} framebuffer Framebuffer.
|
||||
* @param {WebGLTexture} texture Texture.
|
||||
*/
|
||||
function(gl, framebuffer, texture) {
|
||||
if (!gl.isContextLost()) {
|
||||
gl.deleteFramebuffer(framebuffer);
|
||||
gl.deleteTexture(texture);
|
||||
}
|
||||
}, gl, this.framebuffer, this.texture)));
|
||||
/** @type {ol.PostRenderFunction} */ (postRenderFunction)
|
||||
);
|
||||
|
||||
var texture = ol.webgl.Context.createEmptyTexture(
|
||||
gl, framebufferDimension, framebufferDimension);
|
||||
|
||||
Reference in New Issue
Block a user