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
|
'title': zoomInTipLabel
|
||||||
}, zoomInLabel);
|
}, zoomInLabel);
|
||||||
|
|
||||||
ol.events.listen(inElement,
|
ol.events.listen(inElement, ol.events.EventType.CLICK,
|
||||||
ol.events.EventType.CLICK, goog.partial(
|
ol.control.Zoom.prototype.handleClick_.bind(this, delta));
|
||||||
ol.control.Zoom.prototype.handleClick_, delta), this);
|
|
||||||
|
|
||||||
var outElement = goog.dom.createDom('BUTTON', {
|
var outElement = goog.dom.createDom('BUTTON', {
|
||||||
'class': className + '-out',
|
'class': className + '-out',
|
||||||
@@ -52,9 +51,8 @@ ol.control.Zoom = function(opt_options) {
|
|||||||
'title': zoomOutTipLabel
|
'title': zoomOutTipLabel
|
||||||
}, zoomOutLabel);
|
}, zoomOutLabel);
|
||||||
|
|
||||||
ol.events.listen(outElement,
|
ol.events.listen(outElement, ol.events.EventType.CLICK,
|
||||||
ol.events.EventType.CLICK, goog.partial(
|
ol.control.Zoom.prototype.handleClick_.bind(this, -delta));
|
||||||
ol.control.Zoom.prototype.handleClick_, -delta), this);
|
|
||||||
|
|
||||||
var cssClasses = className + ' ' + ol.css.CLASS_UNSELECTABLE + ' ' +
|
var cssClasses = className + ' ' + ol.css.CLASS_UNSELECTABLE + ' ' +
|
||||||
ol.css.CLASS_CONTROL;
|
ol.css.CLASS_CONTROL;
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ ol.interaction.DragAndDrop.handleDrop_ = function(event) {
|
|||||||
file = files.item(i);
|
file = files.item(i);
|
||||||
var reader = new FileReader();
|
var reader = new FileReader();
|
||||||
reader.addEventListener(ol.events.EventType.LOAD,
|
reader.addEventListener(ol.events.EventType.LOAD,
|
||||||
goog.partial(this.handleResult_, file).bind(this));
|
this.handleResult_.bind(this, file));
|
||||||
reader.readAsText(file);
|
reader.readAsText(file);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -181,18 +181,20 @@ ol.renderer.Layer.prototype.renderIfReadyAndVisible = function() {
|
|||||||
*/
|
*/
|
||||||
ol.renderer.Layer.prototype.scheduleExpireCache = function(frameState, tileSource) {
|
ol.renderer.Layer.prototype.scheduleExpireCache = function(frameState, tileSource) {
|
||||||
if (tileSource.canExpireCache()) {
|
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(
|
frameState.postRenderFunctions.push(
|
||||||
/** @type {ol.PostRenderFunction} */ (goog.partial(
|
/** @type {ol.PostRenderFunction} */ (postRenderFunction)
|
||||||
/**
|
);
|
||||||
* @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)));
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -138,17 +138,18 @@ ol.renderer.webgl.ImageLayer.prototype.prepareFrame = function(frameState, layer
|
|||||||
image = image_;
|
image = image_;
|
||||||
texture = this.createTexture_(image_);
|
texture = this.createTexture_(image_);
|
||||||
if (this.texture) {
|
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(
|
frameState.postRenderFunctions.push(
|
||||||
/** @type {ol.PostRenderFunction} */ (goog.partial(
|
/** @type {ol.PostRenderFunction} */ (postRenderFunction)
|
||||||
/**
|
);
|
||||||
* @param {WebGLRenderingContext} gl GL.
|
|
||||||
* @param {WebGLTexture} texture Texture.
|
|
||||||
*/
|
|
||||||
function(gl, texture) {
|
|
||||||
if (!gl.isContextLost()) {
|
|
||||||
gl.deleteTexture(texture);
|
|
||||||
}
|
|
||||||
}, gl, this.texture)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,20 +93,21 @@ ol.renderer.webgl.Layer.prototype.bindFramebuffer = function(frameState, framebu
|
|||||||
|
|
||||||
if (this.framebufferDimension === undefined ||
|
if (this.framebufferDimension === undefined ||
|
||||||
this.framebufferDimension != framebufferDimension) {
|
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(
|
frameState.postRenderFunctions.push(
|
||||||
/** @type {ol.PostRenderFunction} */ (goog.partial(
|
/** @type {ol.PostRenderFunction} */ (postRenderFunction)
|
||||||
/**
|
);
|
||||||
* @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)));
|
|
||||||
|
|
||||||
var texture = ol.webgl.Context.createEmptyTexture(
|
var texture = ol.webgl.Context.createEmptyTexture(
|
||||||
gl, framebufferDimension, framebufferDimension);
|
gl, framebufferDimension, framebufferDimension);
|
||||||
|
|||||||
Reference in New Issue
Block a user