From 6838d59e64ef408dec77cadf6875a2d446462260 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Sat, 10 Feb 2018 09:01:02 +0100 Subject: [PATCH] Remove private static members from ol/render/webgl/ReplayGroup --- src/ol/render/webgl/ReplayGroup.js | 58 +++++++++++++++--------------- 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/src/ol/render/webgl/ReplayGroup.js b/src/ol/render/webgl/ReplayGroup.js index db0c78a5f2..c2f787ad10 100644 --- a/src/ol/render/webgl/ReplayGroup.js +++ b/src/ol/render/webgl/ReplayGroup.js @@ -13,6 +13,25 @@ import WebGLLineStringReplay from '../webgl/LineStringReplay.js'; import WebGLPolygonReplay from '../webgl/PolygonReplay.js'; import WebGLTextReplay from '../webgl/TextReplay.js'; +/** + * @type {Array.} + */ +const HIT_DETECTION_SIZE = [1, 1]; + +/** + * @type {Object.} + */ +const BATCH_CONSTRUCTORS = { + 'Circle': WebGLCircleReplay, + 'Image': WebGLImageReplay, + 'LineString': WebGLLineStringReplay, + 'Polygon': WebGLPolygonReplay, + 'Text': WebGLTextReplay +}; + + /** * @constructor * @extends {ol.render.ReplayGroup} @@ -115,7 +134,7 @@ WebGLReplayGroup.prototype.getReplay = function(zIndex, replayType) { /** * @type {Function} */ - const Constructor = WebGLReplayGroup.BATCH_CONSTRUCTORS_[replayType]; + const Constructor = BATCH_CONSTRUCTORS[replayType]; replay = new Constructor(this.tolerance_, this.maxExtent_); replays[replayType] = replay; } @@ -246,12 +265,12 @@ WebGLReplayGroup.prototype.forEachFeatureAtCoordinate = function( } return this.replayHitDetection_(context, - coordinate, resolution, rotation, WebGLReplayGroup.HIT_DETECTION_SIZE_, + coordinate, resolution, rotation, HIT_DETECTION_SIZE, pixelRatio, opacity, skippedFeaturesHash, /** - * @param {ol.Feature|ol.render.Feature} feature Feature. - * @return {?} Callback result. - */ + * @param {ol.Feature|ol.render.Feature} feature Feature. + * @return {?} Callback result. + */ function(feature) { const imageData = new Uint8Array(4); gl.readPixels(0, 0, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, imageData); @@ -287,12 +306,12 @@ WebGLReplayGroup.prototype.hasFeatureAtCoordinate = function( gl.FRAMEBUFFER, context.getHitDetectionFramebuffer()); const hasFeature = this.replayHitDetection_(context, - coordinate, resolution, rotation, WebGLReplayGroup.HIT_DETECTION_SIZE_, + coordinate, resolution, rotation, HIT_DETECTION_SIZE, pixelRatio, opacity, skippedFeaturesHash, /** - * @param {ol.Feature|ol.render.Feature} feature Feature. - * @return {boolean} Is there a feature? - */ + * @param {ol.Feature|ol.render.Feature} feature Feature. + * @return {boolean} Is there a feature? + */ function(feature) { const imageData = new Uint8Array(4); gl.readPixels(0, 0, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, imageData); @@ -302,25 +321,4 @@ WebGLReplayGroup.prototype.hasFeatureAtCoordinate = function( return hasFeature !== undefined; }; -/** - * @const - * @private - * @type {Array.} - */ -WebGLReplayGroup.HIT_DETECTION_SIZE_ = [1, 1]; - -/** - * @const - * @private - * @type {Object.} - */ -WebGLReplayGroup.BATCH_CONSTRUCTORS_ = { - 'Circle': WebGLCircleReplay, - 'Image': WebGLImageReplay, - 'LineString': WebGLLineStringReplay, - 'Polygon': WebGLPolygonReplay, - 'Text': WebGLTextReplay -}; export default WebGLReplayGroup;