From 4504c422ae7ab8d482d6f216520a90b08fec4e5d Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Mon, 5 Feb 2018 12:40:44 +0100 Subject: [PATCH] Rename _ol_render_canvas_Instruction_ to CanvasInstruction --- src/ol/render/canvas/ImageReplay.js | 10 ++--- src/ol/render/canvas/LineStringReplay.js | 23 +++++----- src/ol/render/canvas/PolygonReplay.js | 33 +++++++-------- src/ol/render/canvas/Replay.js | 53 +++++++++++------------- src/ol/render/canvas/TextReplay.js | 10 ++--- 5 files changed, 62 insertions(+), 67 deletions(-) diff --git a/src/ol/render/canvas/ImageReplay.js b/src/ol/render/canvas/ImageReplay.js index 45e639f972..23310d4190 100644 --- a/src/ol/render/canvas/ImageReplay.js +++ b/src/ol/render/canvas/ImageReplay.js @@ -2,7 +2,7 @@ * @module ol/render/canvas/ImageReplay */ import {inherits} from '../../index.js'; -import _ol_render_canvas_Instruction_ from '../canvas/Instruction.js'; +import CanvasInstruction from '../canvas/Instruction.js'; import CanvasReplay from '../canvas/Replay.js'; /** @@ -138,14 +138,14 @@ CanvasImageReplay.prototype.drawPoint = function(pointGeometry, feature) { const myEnd = this.drawCoordinates_( flatCoordinates, 0, flatCoordinates.length, stride); this.instructions.push([ - _ol_render_canvas_Instruction_.DRAW_IMAGE, myBegin, myEnd, this.image_, + CanvasInstruction.DRAW_IMAGE, myBegin, myEnd, this.image_, // Remaining arguments to DRAW_IMAGE are in alphabetical order this.anchorX_, this.anchorY_, this.declutterGroup_, this.height_, this.opacity_, this.originX_, this.originY_, this.rotateWithView_, this.rotation_, this.scale_ * this.pixelRatio, this.snapToPixel_, this.width_ ]); this.hitDetectionInstructions.push([ - _ol_render_canvas_Instruction_.DRAW_IMAGE, myBegin, myEnd, + CanvasInstruction.DRAW_IMAGE, myBegin, myEnd, this.hitDetectionImage_, // Remaining arguments to DRAW_IMAGE are in alphabetical order this.anchorX_, this.anchorY_, this.declutterGroup_, this.height_, this.opacity_, @@ -170,14 +170,14 @@ CanvasImageReplay.prototype.drawMultiPoint = function(multiPointGeometry, featur const myEnd = this.drawCoordinates_( flatCoordinates, 0, flatCoordinates.length, stride); this.instructions.push([ - _ol_render_canvas_Instruction_.DRAW_IMAGE, myBegin, myEnd, this.image_, + CanvasInstruction.DRAW_IMAGE, myBegin, myEnd, this.image_, // Remaining arguments to DRAW_IMAGE are in alphabetical order this.anchorX_, this.anchorY_, this.declutterGroup_, this.height_, this.opacity_, this.originX_, this.originY_, this.rotateWithView_, this.rotation_, this.scale_ * this.pixelRatio, this.snapToPixel_, this.width_ ]); this.hitDetectionInstructions.push([ - _ol_render_canvas_Instruction_.DRAW_IMAGE, myBegin, myEnd, + CanvasInstruction.DRAW_IMAGE, myBegin, myEnd, this.hitDetectionImage_, // Remaining arguments to DRAW_IMAGE are in alphabetical order this.anchorX_, this.anchorY_, this.declutterGroup_, this.height_, this.opacity_, diff --git a/src/ol/render/canvas/LineStringReplay.js b/src/ol/render/canvas/LineStringReplay.js index 14193caf85..efb0a3df18 100644 --- a/src/ol/render/canvas/LineStringReplay.js +++ b/src/ol/render/canvas/LineStringReplay.js @@ -2,7 +2,7 @@ * @module ol/render/canvas/LineStringReplay */ import {inherits} from '../../index.js'; -import _ol_render_canvas_Instruction_ from '../canvas/Instruction.js'; +import CanvasInstruction from '../canvas/Instruction.js'; import CanvasReplay from '../canvas/Replay.js'; /** @@ -37,8 +37,7 @@ CanvasLineStringReplay.prototype.drawFlatCoordinates_ = function(flatCoordinates const myBegin = this.coordinates.length; const myEnd = this.appendFlatCoordinates( flatCoordinates, offset, end, stride, false, false); - const moveToLineToInstruction = - [_ol_render_canvas_Instruction_.MOVE_TO_LINE_TO, myBegin, myEnd]; + const moveToLineToInstruction = [CanvasInstruction.MOVE_TO_LINE_TO, myBegin, myEnd]; this.instructions.push(moveToLineToInstruction); this.hitDetectionInstructions.push(moveToLineToInstruction); return end; @@ -58,16 +57,16 @@ CanvasLineStringReplay.prototype.drawLineString = function(lineStringGeometry, f this.updateStrokeStyle(state, this.applyStroke); this.beginGeometry(lineStringGeometry, feature); this.hitDetectionInstructions.push([ - _ol_render_canvas_Instruction_.SET_STROKE_STYLE, + CanvasInstruction.SET_STROKE_STYLE, state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin, state.miterLimit, state.lineDash, state.lineDashOffset ], [ - _ol_render_canvas_Instruction_.BEGIN_PATH + CanvasInstruction.BEGIN_PATH ]); const flatCoordinates = lineStringGeometry.getFlatCoordinates(); const stride = lineStringGeometry.getStride(); this.drawFlatCoordinates_(flatCoordinates, 0, flatCoordinates.length, stride); - this.hitDetectionInstructions.push([_ol_render_canvas_Instruction_.STROKE]); + this.hitDetectionInstructions.push([CanvasInstruction.STROKE]); this.endGeometry(lineStringGeometry, feature); }; @@ -85,11 +84,11 @@ CanvasLineStringReplay.prototype.drawMultiLineString = function(multiLineStringG this.updateStrokeStyle(state, this.applyStroke); this.beginGeometry(multiLineStringGeometry, feature); this.hitDetectionInstructions.push([ - _ol_render_canvas_Instruction_.SET_STROKE_STYLE, + CanvasInstruction.SET_STROKE_STYLE, state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin, state.miterLimit, state.lineDash, state.lineDashOffset ], [ - _ol_render_canvas_Instruction_.BEGIN_PATH + CanvasInstruction.BEGIN_PATH ]); const ends = multiLineStringGeometry.getEnds(); const flatCoordinates = multiLineStringGeometry.getFlatCoordinates(); @@ -99,7 +98,7 @@ CanvasLineStringReplay.prototype.drawMultiLineString = function(multiLineStringG offset = this.drawFlatCoordinates_( flatCoordinates, offset, ends[i], stride); } - this.hitDetectionInstructions.push([_ol_render_canvas_Instruction_.STROKE]); + this.hitDetectionInstructions.push([CanvasInstruction.STROKE]); this.endGeometry(multiLineStringGeometry, feature); }; @@ -110,7 +109,7 @@ CanvasLineStringReplay.prototype.drawMultiLineString = function(multiLineStringG CanvasLineStringReplay.prototype.finish = function() { const state = this.state; if (state.lastStroke != undefined && state.lastStroke != this.coordinates.length) { - this.instructions.push([_ol_render_canvas_Instruction_.STROKE]); + this.instructions.push([CanvasInstruction.STROKE]); } this.reverseHitDetectionInstructions(); this.state = null; @@ -122,11 +121,11 @@ CanvasLineStringReplay.prototype.finish = function() { */ CanvasLineStringReplay.prototype.applyStroke = function(state) { if (state.lastStroke != undefined && state.lastStroke != this.coordinates.length) { - this.instructions.push([_ol_render_canvas_Instruction_.STROKE]); + this.instructions.push([CanvasInstruction.STROKE]); state.lastStroke = this.coordinates.length; } state.lastStroke = 0; CanvasReplay.prototype.applyStroke.call(this, state); - this.instructions.push([_ol_render_canvas_Instruction_.BEGIN_PATH]); + this.instructions.push([CanvasInstruction.BEGIN_PATH]); }; export default CanvasLineStringReplay; diff --git a/src/ol/render/canvas/PolygonReplay.js b/src/ol/render/canvas/PolygonReplay.js index ac0ce155c1..07328c96fb 100644 --- a/src/ol/render/canvas/PolygonReplay.js +++ b/src/ol/render/canvas/PolygonReplay.js @@ -5,7 +5,7 @@ import {inherits} from '../../index.js'; import {asString} from '../../color.js'; import _ol_geom_flat_simplify_ from '../../geom/flat/simplify.js'; import _ol_render_canvas_ from '../canvas.js'; -import _ol_render_canvas_Instruction_ from '../canvas/Instruction.js'; +import CanvasInstruction from '../canvas/Instruction.js'; import CanvasReplay from '../canvas/Replay.js'; /** @@ -41,7 +41,7 @@ CanvasPolygonReplay.prototype.drawFlatCoordinatess_ = function(flatCoordinates, const fill = state.fillStyle !== undefined; const stroke = state.strokeStyle != undefined; const numEnds = ends.length; - const beginPathInstruction = [_ol_render_canvas_Instruction_.BEGIN_PATH]; + const beginPathInstruction = [CanvasInstruction.BEGIN_PATH]; this.instructions.push(beginPathInstruction); this.hitDetectionInstructions.push(beginPathInstruction); for (let i = 0; i < numEnds; ++i) { @@ -49,26 +49,25 @@ CanvasPolygonReplay.prototype.drawFlatCoordinatess_ = function(flatCoordinates, const myBegin = this.coordinates.length; const myEnd = this.appendFlatCoordinates( flatCoordinates, offset, end, stride, true, !stroke); - const moveToLineToInstruction = - [_ol_render_canvas_Instruction_.MOVE_TO_LINE_TO, myBegin, myEnd]; + const moveToLineToInstruction = [CanvasInstruction.MOVE_TO_LINE_TO, myBegin, myEnd]; this.instructions.push(moveToLineToInstruction); this.hitDetectionInstructions.push(moveToLineToInstruction); if (stroke) { // Performance optimization: only call closePath() when we have a stroke. // Otherwise the ring is closed already (see appendFlatCoordinates above). - const closePathInstruction = [_ol_render_canvas_Instruction_.CLOSE_PATH]; + const closePathInstruction = [CanvasInstruction.CLOSE_PATH]; this.instructions.push(closePathInstruction); this.hitDetectionInstructions.push(closePathInstruction); } offset = end; } - const fillInstruction = [_ol_render_canvas_Instruction_.FILL]; + const fillInstruction = [CanvasInstruction.FILL]; this.hitDetectionInstructions.push(fillInstruction); if (fill) { this.instructions.push(fillInstruction); } if (stroke) { - const strokeInstruction = [_ol_render_canvas_Instruction_.STROKE]; + const strokeInstruction = [CanvasInstruction.STROKE]; this.instructions.push(strokeInstruction); this.hitDetectionInstructions.push(strokeInstruction); } @@ -90,12 +89,12 @@ CanvasPolygonReplay.prototype.drawCircle = function(circleGeometry, feature) { this.beginGeometry(circleGeometry, feature); // always fill the circle for hit detection this.hitDetectionInstructions.push([ - _ol_render_canvas_Instruction_.SET_FILL_STYLE, + CanvasInstruction.SET_FILL_STYLE, asString(_ol_render_canvas_.defaultFillStyle) ]); if (state.strokeStyle !== undefined) { this.hitDetectionInstructions.push([ - _ol_render_canvas_Instruction_.SET_STROKE_STYLE, + CanvasInstruction.SET_STROKE_STYLE, state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin, state.miterLimit, state.lineDash, state.lineDashOffset ]); @@ -105,17 +104,17 @@ CanvasPolygonReplay.prototype.drawCircle = function(circleGeometry, feature) { const myBegin = this.coordinates.length; this.appendFlatCoordinates( flatCoordinates, 0, flatCoordinates.length, stride, false, false); - const beginPathInstruction = [_ol_render_canvas_Instruction_.BEGIN_PATH]; - const circleInstruction = [_ol_render_canvas_Instruction_.CIRCLE, myBegin]; + const beginPathInstruction = [CanvasInstruction.BEGIN_PATH]; + const circleInstruction = [CanvasInstruction.CIRCLE, myBegin]; this.instructions.push(beginPathInstruction, circleInstruction); this.hitDetectionInstructions.push(beginPathInstruction, circleInstruction); - const fillInstruction = [_ol_render_canvas_Instruction_.FILL]; + const fillInstruction = [CanvasInstruction.FILL]; this.hitDetectionInstructions.push(fillInstruction); if (state.fillStyle !== undefined) { this.instructions.push(fillInstruction); } if (state.strokeStyle !== undefined) { - const strokeInstruction = [_ol_render_canvas_Instruction_.STROKE]; + const strokeInstruction = [CanvasInstruction.STROKE]; this.instructions.push(strokeInstruction); this.hitDetectionInstructions.push(strokeInstruction); } @@ -132,12 +131,12 @@ CanvasPolygonReplay.prototype.drawPolygon = function(polygonGeometry, feature) { this.beginGeometry(polygonGeometry, feature); // always fill the polygon for hit detection this.hitDetectionInstructions.push([ - _ol_render_canvas_Instruction_.SET_FILL_STYLE, + CanvasInstruction.SET_FILL_STYLE, asString(_ol_render_canvas_.defaultFillStyle)] ); if (state.strokeStyle !== undefined) { this.hitDetectionInstructions.push([ - _ol_render_canvas_Instruction_.SET_STROKE_STYLE, + CanvasInstruction.SET_STROKE_STYLE, state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin, state.miterLimit, state.lineDash, state.lineDashOffset ]); @@ -164,12 +163,12 @@ CanvasPolygonReplay.prototype.drawMultiPolygon = function(multiPolygonGeometry, this.beginGeometry(multiPolygonGeometry, feature); // always fill the multi-polygon for hit detection this.hitDetectionInstructions.push([ - _ol_render_canvas_Instruction_.SET_FILL_STYLE, + CanvasInstruction.SET_FILL_STYLE, asString(_ol_render_canvas_.defaultFillStyle) ]); if (state.strokeStyle !== undefined) { this.hitDetectionInstructions.push([ - _ol_render_canvas_Instruction_.SET_STROKE_STYLE, + CanvasInstruction.SET_STROKE_STYLE, state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin, state.miterLimit, state.lineDash, state.lineDashOffset ]); diff --git a/src/ol/render/canvas/Replay.js b/src/ol/render/canvas/Replay.js index e3f5c90dfd..bd79447504 100644 --- a/src/ol/render/canvas/Replay.js +++ b/src/ol/render/canvas/Replay.js @@ -16,7 +16,7 @@ import _ol_has_ from '../../has.js'; import {isEmpty} from '../../obj.js'; import VectorContext from '../VectorContext.js'; import _ol_render_canvas_ from '../canvas.js'; -import _ol_render_canvas_Instruction_ from '../canvas/Instruction.js'; +import CanvasInstruction from '../canvas/Instruction.js'; import _ol_render_replay_ from '../replay.js'; import _ol_transform_ from '../../transform.js'; @@ -409,7 +409,7 @@ CanvasReplay.prototype.drawCustom = function(geometry, feature, renderer) { offset = this.drawCustomCoordinates_(flatCoordinates, offset, endss[i], stride, myEnds); replayEndss.push(myEnds); } - this.instructions.push([_ol_render_canvas_Instruction_.CUSTOM, + this.instructions.push([CanvasInstruction.CUSTOM, replayBegin, replayEndss, geometry, renderer, _ol_geom_flat_inflate_.coordinatesss]); } else if (type == GeometryType.POLYGON || type == GeometryType.MULTI_LINE_STRING) { replayEnds = []; @@ -419,19 +419,19 @@ CanvasReplay.prototype.drawCustom = function(geometry, feature, renderer) { offset = this.drawCustomCoordinates_(flatCoordinates, 0, /** @type {ol.geom.Polygon|ol.geom.MultiLineString} */ (geometry).getEnds(), stride, replayEnds); - this.instructions.push([_ol_render_canvas_Instruction_.CUSTOM, + this.instructions.push([CanvasInstruction.CUSTOM, replayBegin, replayEnds, geometry, renderer, _ol_geom_flat_inflate_.coordinatess]); } else if (type == GeometryType.LINE_STRING || type == GeometryType.MULTI_POINT) { flatCoordinates = geometry.getFlatCoordinates(); replayEnd = this.appendFlatCoordinates( flatCoordinates, 0, flatCoordinates.length, stride, false, false); - this.instructions.push([_ol_render_canvas_Instruction_.CUSTOM, + this.instructions.push([CanvasInstruction.CUSTOM, replayBegin, replayEnd, geometry, renderer, _ol_geom_flat_inflate_.coordinates]); } else if (type == GeometryType.POINT) { flatCoordinates = geometry.getFlatCoordinates(); this.coordinates.push(flatCoordinates[0], flatCoordinates[1]); replayEnd = this.coordinates.length; - this.instructions.push([_ol_render_canvas_Instruction_.CUSTOM, + this.instructions.push([CanvasInstruction.CUSTOM, replayBegin, replayEnd, geometry, renderer]); } this.endGeometry(geometry, feature); @@ -444,11 +444,9 @@ CanvasReplay.prototype.drawCustom = function(geometry, feature, renderer) { * @param {ol.Feature|ol.render.Feature} feature Feature. */ CanvasReplay.prototype.beginGeometry = function(geometry, feature) { - this.beginGeometryInstruction1_ = - [_ol_render_canvas_Instruction_.BEGIN_GEOMETRY, feature, 0]; + this.beginGeometryInstruction1_ = [CanvasInstruction.BEGIN_GEOMETRY, feature, 0]; this.instructions.push(this.beginGeometryInstruction1_); - this.beginGeometryInstruction2_ = - [_ol_render_canvas_Instruction_.BEGIN_GEOMETRY, feature, 0]; + this.beginGeometryInstruction2_ = [CanvasInstruction.BEGIN_GEOMETRY, feature, 0]; this.hitDetectionInstructions.push(this.beginGeometryInstruction2_); }; @@ -586,7 +584,7 @@ CanvasReplay.prototype.replay_ = function( const instruction = instructions[i]; const type = /** @type {ol.render.canvas.Instruction} */ (instruction[0]); switch (type) { - case _ol_render_canvas_Instruction_.BEGIN_GEOMETRY: + case CanvasInstruction.BEGIN_GEOMETRY: feature = /** @type {ol.Feature|ol.render.Feature} */ (instruction[1]); if ((skipFeatures && skippedFeaturesHash[getUid(feature).toString()]) || @@ -599,7 +597,7 @@ CanvasReplay.prototype.replay_ = function( ++i; } break; - case _ol_render_canvas_Instruction_.BEGIN_PATH: + case CanvasInstruction.BEGIN_PATH: if (pendingFill > batchSize) { this.fill_(context); pendingFill = 0; @@ -614,7 +612,7 @@ CanvasReplay.prototype.replay_ = function( } ++i; break; - case _ol_render_canvas_Instruction_.CIRCLE: + case CanvasInstruction.CIRCLE: d = /** @type {number} */ (instruction[1]); const x1 = pixelCoordinates[d]; const y1 = pixelCoordinates[d + 1]; @@ -627,11 +625,11 @@ CanvasReplay.prototype.replay_ = function( context.arc(x1, y1, r, 0, 2 * Math.PI, true); ++i; break; - case _ol_render_canvas_Instruction_.CLOSE_PATH: + case CanvasInstruction.CLOSE_PATH: context.closePath(); ++i; break; - case _ol_render_canvas_Instruction_.CUSTOM: + case CanvasInstruction.CUSTOM: d = /** @type {number} */ (instruction[1]); dd = instruction[2]; const geometry = /** @type {ol.geom.SimpleGeometry} */ (instruction[3]); @@ -653,7 +651,7 @@ CanvasReplay.prototype.replay_ = function( renderer(coords, state); ++i; break; - case _ol_render_canvas_Instruction_.DRAW_IMAGE: + case CanvasInstruction.DRAW_IMAGE: d = /** @type {number} */ (instruction[1]); dd = /** @type {number} */ (instruction[2]); image = /** @type {HTMLCanvasElement|HTMLVideoElement|Image} */ @@ -696,7 +694,7 @@ CanvasReplay.prototype.replay_ = function( this.renderDeclutter_(declutterGroup, feature); ++i; break; - case _ol_render_canvas_Instruction_.DRAW_CHARS: + case CanvasInstruction.DRAW_CHARS: const begin = /** @type {number} */ (instruction[1]); const end = /** @type {number} */ (instruction[2]); const baseline = /** @type {number} */ (instruction[3]); @@ -754,7 +752,7 @@ CanvasReplay.prototype.replay_ = function( this.renderDeclutter_(declutterGroup, feature); ++i; break; - case _ol_render_canvas_Instruction_.END_GEOMETRY: + case CanvasInstruction.END_GEOMETRY: if (featureCallback !== undefined) { feature = /** @type {ol.Feature|ol.render.Feature} */ (instruction[1]); const result = featureCallback(feature); @@ -764,7 +762,7 @@ CanvasReplay.prototype.replay_ = function( } ++i; break; - case _ol_render_canvas_Instruction_.FILL: + case CanvasInstruction.FILL: if (batchSize) { pendingFill++; } else { @@ -772,7 +770,7 @@ CanvasReplay.prototype.replay_ = function( } ++i; break; - case _ol_render_canvas_Instruction_.MOVE_TO_LINE_TO: + case CanvasInstruction.MOVE_TO_LINE_TO: d = /** @type {number} */ (instruction[1]); dd = /** @type {number} */ (instruction[2]); x = pixelCoordinates[d]; @@ -797,7 +795,7 @@ CanvasReplay.prototype.replay_ = function( } ++i; break; - case _ol_render_canvas_Instruction_.SET_FILL_STYLE: + case CanvasInstruction.SET_FILL_STYLE: lastFillInstruction = instruction; this.fillOrigin_ = instruction[2]; @@ -813,7 +811,7 @@ CanvasReplay.prototype.replay_ = function( context.fillStyle = /** @type {ol.ColorLike} */ (instruction[1]); ++i; break; - case _ol_render_canvas_Instruction_.SET_STROKE_STYLE: + case CanvasInstruction.SET_STROKE_STYLE: lastStrokeInstruction = instruction; if (pendingStroke) { context.stroke(); @@ -822,7 +820,7 @@ CanvasReplay.prototype.replay_ = function( this.setStrokeStyle_(context, /** @type {Array.<*>} */ (instruction)); ++i; break; - case _ol_render_canvas_Instruction_.STROKE: + case CanvasInstruction.STROKE: if (batchSize) { pendingStroke++; } else { @@ -898,9 +896,9 @@ CanvasReplay.prototype.reverseHitDetectionInstructions = function() { for (i = 0; i < n; ++i) { instruction = hitDetectionInstructions[i]; type = /** @type {ol.render.canvas.Instruction} */ (instruction[0]); - if (type == _ol_render_canvas_Instruction_.END_GEOMETRY) { + if (type == CanvasInstruction.END_GEOMETRY) { begin = i; - } else if (type == _ol_render_canvas_Instruction_.BEGIN_GEOMETRY) { + } else if (type == CanvasInstruction.BEGIN_GEOMETRY) { instruction[2] = i; reverseSubArray(this.hitDetectionInstructions, begin, i); begin = -1; @@ -968,7 +966,7 @@ CanvasReplay.prototype.setFillStrokeStyle = function(fillStyle, strokeStyle) { */ CanvasReplay.prototype.createFill = function(state, geometry) { const fillStyle = state.fillStyle; - const fillInstruction = [_ol_render_canvas_Instruction_.SET_FILL_STYLE, fillStyle]; + const fillInstruction = [CanvasInstruction.SET_FILL_STYLE, fillStyle]; if (typeof fillStyle !== 'string') { const fillExtent = geometry.getExtent(); fillInstruction.push([fillExtent[0], fillExtent[3]]); @@ -991,7 +989,7 @@ CanvasReplay.prototype.applyStroke = function(state) { */ CanvasReplay.prototype.createStroke = function(state) { return [ - _ol_render_canvas_Instruction_.SET_STROKE_STYLE, + CanvasInstruction.SET_STROKE_STYLE, state.strokeStyle, state.lineWidth * this.pixelRatio, state.lineCap, state.lineJoin, state.miterLimit, this.applyPixelRatio(state.lineDash), state.lineDashOffset * this.pixelRatio @@ -1057,8 +1055,7 @@ CanvasReplay.prototype.endGeometry = function(geometry, feature) { this.beginGeometryInstruction1_ = null; this.beginGeometryInstruction2_[2] = this.hitDetectionInstructions.length; this.beginGeometryInstruction2_ = null; - const endGeometryInstruction = - [_ol_render_canvas_Instruction_.END_GEOMETRY, feature]; + const endGeometryInstruction = [CanvasInstruction.END_GEOMETRY, feature]; this.instructions.push(endGeometryInstruction); this.hitDetectionInstructions.push(endGeometryInstruction); }; diff --git a/src/ol/render/canvas/TextReplay.js b/src/ol/render/canvas/TextReplay.js index 18aed7bffb..2cd45db4f7 100644 --- a/src/ol/render/canvas/TextReplay.js +++ b/src/ol/render/canvas/TextReplay.js @@ -9,7 +9,7 @@ import _ol_geom_flat_straightchunk_ from '../../geom/flat/straightchunk.js'; import GeometryType from '../../geom/GeometryType.js'; import _ol_has_ from '../../has.js'; import _ol_render_canvas_ from '../canvas.js'; -import _ol_render_canvas_Instruction_ from '../canvas/Instruction.js'; +import CanvasInstruction from '../canvas/Instruction.js'; import CanvasReplay from '../canvas/Replay.js'; import _ol_render_replay_ from '../replay.js'; import TextPlacement from '../../style/TextPlacement.js'; @@ -362,7 +362,7 @@ CanvasTextReplay.prototype.drawTextImage_ = function(label, begin, end) { const anchorX = align * label.width / pixelRatio + 2 * (0.5 - align) * strokeWidth; const anchorY = baseline * label.height / pixelRatio + 2 * (0.5 - baseline) * strokeWidth; - this.instructions.push([_ol_render_canvas_Instruction_.DRAW_IMAGE, begin, end, + this.instructions.push([CanvasInstruction.DRAW_IMAGE, begin, end, label, (anchorX - this.textOffsetX_) * pixelRatio, (anchorY - this.textOffsetY_) * pixelRatio, this.declutterGroup_, label.height, 1, 0, 0, this.textRotateWithView_, this.textRotation_, 1, true, label.width, @@ -372,7 +372,7 @@ CanvasTextReplay.prototype.drawTextImage_ = function(label, begin, end) { }), !!textState.backgroundFill, !!textState.backgroundStroke ]); - this.hitDetectionInstructions.push([_ol_render_canvas_Instruction_.DRAW_IMAGE, begin, end, + this.hitDetectionInstructions.push([CanvasInstruction.DRAW_IMAGE, begin, end, label, (anchorX - this.textOffsetX_) * pixelRatio, (anchorY - this.textOffsetY_) * pixelRatio, this.declutterGroup_, label.height, 1, 0, 0, this.textRotateWithView_, this.textRotation_, 1 / pixelRatio, true, label.width, textState.padding, @@ -435,7 +435,7 @@ CanvasTextReplay.prototype.drawChars_ = function(begin, end, declutterGroup) { if (!widths) { this.widths_[font] = widths = {}; } - this.instructions.push([_ol_render_canvas_Instruction_.DRAW_CHARS, + this.instructions.push([CanvasInstruction.DRAW_CHARS, begin, end, baseline, declutterGroup, textState.overflow, fillKey, textState.maxAngle, function(text) { @@ -447,7 +447,7 @@ CanvasTextReplay.prototype.drawChars_ = function(begin, end, declutterGroup) { }, offsetY, strokeKey, strokeWidth * pixelRatio, text, textKey, 1 ]); - this.hitDetectionInstructions.push([_ol_render_canvas_Instruction_.DRAW_CHARS, + this.hitDetectionInstructions.push([CanvasInstruction.DRAW_CHARS, begin, end, baseline, declutterGroup, textState.overflow, fillKey, textState.maxAngle, function(text) {