diff --git a/src/ol/render/webgl/ReplayGroup.js b/src/ol/render/webgl/ReplayGroup.js index cac206a003..4e04289346 100644 --- a/src/ol/render/webgl/ReplayGroup.js +++ b/src/ol/render/webgl/ReplayGroup.js @@ -11,7 +11,7 @@ import WebGLCircleReplay from '../webgl/CircleReplay.js'; import WebGLImageReplay from '../webgl/ImageReplay.js'; import WebGLLineStringReplay from '../webgl/LineStringReplay.js'; import WebGLPolygonReplay from '../webgl/PolygonReplay.js'; -import _ol_render_webgl_TextReplay_ from '../webgl/TextReplay.js'; +import WebGLTextReplay from '../webgl/TextReplay.js'; /** * @constructor @@ -321,6 +321,6 @@ WebGLReplayGroup.BATCH_CONSTRUCTORS_ = { 'Image': WebGLImageReplay, 'LineString': WebGLLineStringReplay, 'Polygon': WebGLPolygonReplay, - 'Text': _ol_render_webgl_TextReplay_ + 'Text': WebGLTextReplay }; export default WebGLReplayGroup; diff --git a/src/ol/render/webgl/TextReplay.js b/src/ol/render/webgl/TextReplay.js index ab84cce5eb..1634d12213 100644 --- a/src/ol/render/webgl/TextReplay.js +++ b/src/ol/render/webgl/TextReplay.js @@ -19,7 +19,7 @@ import _ol_webgl_Buffer_ from '../../webgl/Buffer.js'; * @param {ol.Extent} maxExtent Max extent. * @struct */ -const _ol_render_webgl_TextReplay_ = function(tolerance, maxExtent) { +const WebGLTextReplay = function(tolerance, maxExtent) { WebGLTextureReplay.call(this, tolerance, maxExtent); /** @@ -114,13 +114,13 @@ const _ol_render_webgl_TextReplay_ = function(tolerance, maxExtent) { }; -inherits(_ol_render_webgl_TextReplay_, WebGLTextureReplay); +inherits(WebGLTextReplay, WebGLTextureReplay); /** * @inheritDoc */ -_ol_render_webgl_TextReplay_.prototype.drawText = function(geometry, feature) { +WebGLTextReplay.prototype.drawText = function(geometry, feature) { if (this.text_) { let flatCoordinates = null; const offset = 0; @@ -208,7 +208,7 @@ _ol_render_webgl_TextReplay_.prototype.drawText = function(geometry, feature) { * @param {Array.} lines Label to draw split to lines. * @return {Array.} Size of the label in pixels. */ -_ol_render_webgl_TextReplay_.prototype.getTextSize_ = function(lines) { +WebGLTextReplay.prototype.getTextSize_ = function(lines) { const self = this; const glyphAtlas = this.currAtlas_; const textHeight = lines.length * glyphAtlas.height; @@ -239,7 +239,7 @@ _ol_render_webgl_TextReplay_.prototype.getTextSize_ = function(lines) { * @param {number} end End. * @param {number} stride Stride. */ -_ol_render_webgl_TextReplay_.prototype.drawText_ = function(flatCoordinates, offset, +WebGLTextReplay.prototype.drawText_ = function(flatCoordinates, offset, end, stride) { let i, ii; for (i = offset, ii = end; i < ii; i += stride) { @@ -252,7 +252,7 @@ _ol_render_webgl_TextReplay_.prototype.drawText_ = function(flatCoordinates, off * @private * @param {string} char Character. */ -_ol_render_webgl_TextReplay_.prototype.addCharToAtlas_ = function(char) { +WebGLTextReplay.prototype.addCharToAtlas_ = function(char) { if (char.length === 1) { const glyphAtlas = this.currAtlas_; const state = this.state_; @@ -302,7 +302,7 @@ _ol_render_webgl_TextReplay_.prototype.addCharToAtlas_ = function(char) { /** * @inheritDoc */ -_ol_render_webgl_TextReplay_.prototype.finish = function(context) { +WebGLTextReplay.prototype.finish = function(context) { const gl = context.getGL(); this.groupIndices.push(this.indices.length); @@ -347,7 +347,7 @@ _ol_render_webgl_TextReplay_.prototype.finish = function(context) { /** * @inheritDoc */ -_ol_render_webgl_TextReplay_.prototype.setTextStyle = function(textStyle) { +WebGLTextReplay.prototype.setTextStyle = function(textStyle) { const state = this.state_; const textFillStyle = textStyle.getFill(); const textStrokeStyle = textStyle.getStroke(); @@ -400,7 +400,7 @@ _ol_render_webgl_TextReplay_.prototype.setTextStyle = function(textStyle) { * @param {Object} state Font attributes. * @return {ol.WebglGlyphAtlas} Glyph atlas. */ -_ol_render_webgl_TextReplay_.prototype.getAtlas_ = function(state) { +WebGLTextReplay.prototype.getAtlas_ = function(state) { let params = []; let i; for (i in state) { @@ -436,7 +436,7 @@ _ol_render_webgl_TextReplay_.prototype.getAtlas_ = function(state) { * @param {Array.} params Array of parameters. * @return {string} Hash string. */ -_ol_render_webgl_TextReplay_.prototype.calculateHash_ = function(params) { +WebGLTextReplay.prototype.calculateHash_ = function(params) { //TODO: Create a more performant, reliable, general hash function. let i, ii; let hash = ''; @@ -450,7 +450,7 @@ _ol_render_webgl_TextReplay_.prototype.calculateHash_ = function(params) { /** * @inheritDoc */ -_ol_render_webgl_TextReplay_.prototype.getTextures = function(opt_all) { +WebGLTextReplay.prototype.getTextures = function(opt_all) { return this.textures_; }; @@ -458,7 +458,7 @@ _ol_render_webgl_TextReplay_.prototype.getTextures = function(opt_all) { /** * @inheritDoc */ -_ol_render_webgl_TextReplay_.prototype.getHitDetectionTextures = function() { +WebGLTextReplay.prototype.getHitDetectionTextures = function() { return this.textures_; }; -export default _ol_render_webgl_TextReplay_; +export default WebGLTextReplay; diff --git a/test/spec/ol/render/webgl/textreplay.test.js b/test/spec/ol/render/webgl/textreplay.test.js index d051b55db3..226be96c91 100644 --- a/test/spec/ol/render/webgl/textreplay.test.js +++ b/test/spec/ol/render/webgl/textreplay.test.js @@ -1,6 +1,6 @@ import {createCanvasContext2D} from '../../../../../src/ol/dom.js'; import Point from '../../../../../src/ol/geom/Point.js'; -import _ol_render_webgl_TextReplay_ from '../../../../../src/ol/render/webgl/TextReplay.js'; +import WebGLTextReplay from '../../../../../src/ol/render/webgl/TextReplay.js'; import Fill from '../../../../../src/ol/style/Fill.js'; import Stroke from '../../../../../src/ol/style/Stroke.js'; import Text from '../../../../../src/ol/style/Text.js'; @@ -28,7 +28,7 @@ describe('ol.render.webgl.TextReplay', function() { beforeEach(function() { const tolerance = 0.1; const maxExtent = [-10000, -20000, 10000, 20000]; - replay = new _ol_render_webgl_TextReplay_(tolerance, maxExtent); + replay = new WebGLTextReplay(tolerance, maxExtent); }); describe('#setTextStyle', function() {