ol/geom/flat/straightchunk export

This commit is contained in:
raiyni
2018-02-12 23:42:11 -06:00
parent 2550ab1691
commit 78b418ba9d
3 changed files with 11 additions and 13 deletions

View File

@@ -1,7 +1,6 @@
/**
* @module ol/geom/flat/straightchunk
*/
const _ol_geom_flat_straightchunk_ = {};
/**
@@ -13,7 +12,7 @@ const _ol_geom_flat_straightchunk_ = {};
* @return {Array.<number>} Start and end of the first suitable chunk of the
* given `flatCoordinates`.
*/
_ol_geom_flat_straightchunk_.lineString = function(maxAngle, flatCoordinates, offset, end, stride) {
export function matchingChunk(maxAngle, flatCoordinates, offset, end, stride) {
let chunkStart = offset;
let chunkEnd = offset;
let chunkM = 0;
@@ -49,5 +48,4 @@ _ol_geom_flat_straightchunk_.lineString = function(maxAngle, flatCoordinates, of
}
m += m23;
return m > chunkM ? [start, i] : [chunkStart, chunkEnd];
};
export default _ol_geom_flat_straightchunk_;
}

View File

@@ -5,7 +5,7 @@ import {getUid, inherits} from '../../index.js';
import {asColorLike} from '../../colorlike.js';
import {createCanvasContext2D} from '../../dom.js';
import {intersects} from '../../extent.js';
import _ol_geom_flat_straightchunk_ from '../../geom/flat/straightchunk.js';
import {matchingChunk} from '../../geom/flat/straightchunk.js';
import GeometryType from '../../geom/GeometryType.js';
import {CANVAS_LINE_DASH, SAFARI} from '../../has.js';
import _ol_render_canvas_ from '../canvas.js';
@@ -202,7 +202,7 @@ CanvasTextReplay.prototype.drawText = function(geometry, feature) {
let flatEnd;
for (let o = 0, oo = ends.length; o < oo; ++o) {
if (textAlign == undefined) {
const range = _ol_geom_flat_straightchunk_.lineString(
const range = matchingChunk(
textState.maxAngle, flatCoordinates, flatOffset, ends[o], stride);
flatOffset = range[0];
flatEnd = range[1];