ol 10.6.2-dev.1754333306603 → 10.6.2-dev.1754660719063

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ol",
3
- "version": "10.6.2-dev.1754333306603",
3
+ "version": "10.6.2-dev.1754660719063",
4
4
  "description": "OpenLayers mapping library",
5
5
  "keywords": [
6
6
  "map",
@@ -118,6 +118,11 @@ export class ShaderBuilder {
118
118
  * @private
119
119
  */
120
120
  private strokeDistanceFieldExpression_;
121
+ /**
122
+ * @private
123
+ * @type {string}
124
+ */
125
+ private strokePatternLengthExpression_;
121
126
  /**
122
127
  * @type {boolean}
123
128
  * @private
@@ -272,6 +277,20 @@ export class ShaderBuilder {
272
277
  * @return {ShaderBuilder} the builder object
273
278
  */
274
279
  setStrokeDistanceFieldExpression(expression: string): ShaderBuilder;
280
+ /**
281
+ * Defining a pattern length for a stroke lets us avoid having visual artifacts when
282
+ * a linestring is very long and thus has very high "distance" attributes on its vertices.
283
+ * If we apply a pattern or dash array to a stroke we know for certain that the full distance value
284
+ * is not necessary and can be trimmed down using `mod(currentDistance, patternLength)`.
285
+ * @param {string} expression Stroke expression that evaluates to a`float; value is expected to be
286
+ * in pixels.
287
+ * @return {ShaderBuilder} the builder object
288
+ */
289
+ setStrokePatternLengthExpression(expression: string): ShaderBuilder;
290
+ /**
291
+ * @return {string} The current stroke pattern length expression.
292
+ */
293
+ getStrokePatternLengthExpression(): string;
275
294
  /**
276
295
  * @param {string} expression Fill color expression, evaluate to `vec4`
277
296
  * @return {ShaderBuilder} the builder object
@@ -1 +1 @@
1
- {"version":3,"file":"ShaderBuilder.d.ts","sourceRoot":"","sources":["ShaderBuilder.js"],"names":[],"mappings":"AAQA,oqBAsBE;AAIF;;;;;;;GAOG;AAEH;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH;IAEI;;;;OAIG;IACH,kBAAmB;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aAAa,CAKxB;IAED;;;;;;;;OAQG;IACH,yCAHW,MAAM,GACL,aAAa,CAKxB;IAED;;OAEG;IACH,gCAFY,MAAM,CAIjB;IAED;;;;;OAKG;IACH,wCAHW,OAAO,GACN,aAAa,CAKxB;IAED;;;OAGG;IACH,qCAHW,MAAM,GACL,aAAa,CAMxB;IAED;;;OAGG;IACH,qCAHW,MAAM,GACL,aAAa,CAMxB;IAED;;OAEG;IACH,4BAFY,MAAM,CAIjB;IAED;;;OAGG;IACH,sCAHW,MAAM,GACL,aAAa,CAKxB;IAED;;;OAGG;IACH,mCAHW,MAAM,GACL,aAAa,CAKxB;IAED;;;OAGG;IACH,oCAHW,MAAM,GACL,aAAa,CAKxB;IAED;;;OAGG;IACH,0CAHW,MAAM,GACL,aAAa,CAKxB;IAED;;;;OAIG;IACH,6CAJW,MAAM,GAEL,aAAa,CAKxB;IAED;;;OAGG;IACH,mCAHW,MAAM,GACL,aAAa,CAMxB;IAED;;OAEG;IACH,0BAFY,MAAM,CAIjB;IAED,yCAMC;IACD,2CAMC;IAED;;;OAGG;IACH,yBAFY,MAAM,GAAC,IAAI,CAgEtB;IAED;;;OAGG;IACH,2BAFY,MAAM,GAAC,IAAI,CAwCtB;IAED;;;OAGG;IACH,yBAFY,MAAM,GAAC,IAAI,CAmHtB;IAED;;;;OAIG;IACH,2BAFY,MAAM,GAAC,IAAI,CA+KtB;IAED;;;;OAIG;IACH,uBAFY,MAAM,GAAC,IAAI,CA+BtB;IAED;;;OAGG;IACH,yBAFY,MAAM,GAAC,IAAI,CAyDtB;CACF;;;;;UAx6Ba,MAAM;;;;UACN,MAAM;;;;iBACN,MAAM;;;;iBACN,MAAM;;;;uBACN,MAAM;;;;;;UAKN,MAAM;;;;UACN,MAAM"}
1
+ {"version":3,"file":"ShaderBuilder.d.ts","sourceRoot":"","sources":["ShaderBuilder.js"],"names":[],"mappings":"AAQA,oqBAsBE;AAIF;;;;;;;GAOG;AAEH;;;;GAIG;AAEH;;;;;;;;;;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KN,MAAM;;;;UACN,MAAM"}
@@ -178,6 +178,12 @@ export class ShaderBuilder {
178
178
  */
179
179
  this.strokeDistanceFieldExpression_ = '-1000.';
180
180
 
181
+ /**
182
+ * @private
183
+ * @type {string}
184
+ */
185
+ this.strokePatternLengthExpression_ = null;
186
+
181
187
  /**
182
188
  * @type {boolean}
183
189
  * @private
@@ -431,6 +437,27 @@ export class ShaderBuilder {
431
437
  return this;
432
438
  }
433
439
 
440
+ /**
441
+ * Defining a pattern length for a stroke lets us avoid having visual artifacts when
442
+ * a linestring is very long and thus has very high "distance" attributes on its vertices.
443
+ * If we apply a pattern or dash array to a stroke we know for certain that the full distance value
444
+ * is not necessary and can be trimmed down using `mod(currentDistance, patternLength)`.
445
+ * @param {string} expression Stroke expression that evaluates to a`float; value is expected to be
446
+ * in pixels.
447
+ * @return {ShaderBuilder} the builder object
448
+ */
449
+ setStrokePatternLengthExpression(expression) {
450
+ this.strokePatternLengthExpression_ = expression;
451
+ return this;
452
+ }
453
+
454
+ /**
455
+ * @return {string} The current stroke pattern length expression.
456
+ */
457
+ getStrokePatternLengthExpression() {
458
+ return this.strokePatternLengthExpression_;
459
+ }
460
+
434
461
  /**
435
462
  * @param {string} expression Fill color expression, evaluate to `vec4`
436
463
  * @return {ShaderBuilder} the builder object
@@ -592,17 +619,18 @@ attribute vec2 a_localPosition;
592
619
  attribute float a_measureStart;
593
620
  attribute float a_measureEnd;
594
621
  attribute float a_angleTangentSum;
595
- attribute float a_distance;
622
+ attribute float a_distanceLow;
623
+ attribute float a_distanceHigh;
596
624
  attribute vec2 a_joinAngles;
597
625
  attribute vec4 a_hitColor;
598
626
 
599
- varying vec2 v_segmentStart;
600
- varying vec2 v_segmentEnd;
627
+ varying vec2 v_segmentStartPx;
628
+ varying vec2 v_segmentEndPx;
601
629
  varying float v_angleStart;
602
630
  varying float v_angleEnd;
603
631
  varying float v_width;
604
632
  varying vec4 v_hitColor;
605
- varying float v_distanceOffsetPx;
633
+ varying float v_distancePx;
606
634
  varying float v_measureStart;
607
635
  varying float v_measureEnd;
608
636
 
@@ -678,11 +706,21 @@ void main(void) {
678
706
  positionPx = positionPx + joinDirection * (lineWidth * 0.5 + 1.); // adding 1 pixel for antialiasing
679
707
  gl_Position = pxToScreen(positionPx);
680
708
 
681
- v_segmentStart = segmentStartPx;
682
- v_segmentEnd = segmentEndPx;
709
+ v_segmentStartPx = segmentStartPx;
710
+ v_segmentEndPx = segmentEndPx;
683
711
  v_width = lineWidth;
684
712
  v_hitColor = a_hitColor;
685
- v_distanceOffsetPx = a_distance / u_resolution - (lineOffsetPx * a_angleTangentSum);
713
+
714
+ v_distancePx = a_distanceLow / u_resolution - (lineOffsetPx * a_angleTangentSum);
715
+ float distanceHighPx = a_distanceHigh / u_resolution;
716
+ ${
717
+ this.strokePatternLengthExpression_ !== null
718
+ ? `v_distancePx = mod(v_distancePx, ${this.strokePatternLengthExpression_});
719
+ distanceHighPx = mod(distanceHighPx, ${this.strokePatternLengthExpression_});
720
+ `
721
+ : ''
722
+ }v_distancePx += distanceHighPx;
723
+
686
724
  v_measureStart = a_measureStart;
687
725
  v_measureEnd = a_measureEnd;
688
726
  ${this.attributes_
@@ -706,13 +744,13 @@ ${this.attributes_
706
744
 
707
745
  return `${COMMON_HEADER}
708
746
  ${this.uniforms_.map((uniform) => `uniform ${uniform.type} ${uniform.name};`).join('\n')}
709
- varying vec2 v_segmentStart;
710
- varying vec2 v_segmentEnd;
747
+ varying vec2 v_segmentStartPx;
748
+ varying vec2 v_segmentEndPx;
711
749
  varying float v_angleStart;
712
750
  varying float v_angleEnd;
713
751
  varying float v_width;
714
752
  varying vec4 v_hitColor;
715
- varying float v_distanceOffsetPx;
753
+ varying float v_distancePx;
716
754
  varying float v_measureStart;
717
755
  varying float v_measureEnd;
718
756
  ${this.attributes_
@@ -821,9 +859,9 @@ ${this.attributes_
821
859
  )
822
860
  .join('\n')}
823
861
 
824
- vec2 currentPoint = gl_FragCoord.xy / u_pixelRatio;
862
+ vec2 currentPointPx = gl_FragCoord.xy / u_pixelRatio;
825
863
  #ifdef GL_FRAGMENT_PRECISION_HIGH
826
- vec2 worldPos = pxToWorld(currentPoint);
864
+ vec2 worldPos = pxToWorld(currentPointPx);
827
865
  if (
828
866
  abs(u_renderExtent[0] - u_renderExtent[2]) > 0.0 && (
829
867
  worldPos[0] < u_renderExtent[0] ||
@@ -836,28 +874,25 @@ ${this.attributes_
836
874
  }
837
875
  #endif
838
876
 
839
- float segmentLength = length(v_segmentEnd - v_segmentStart);
840
- vec2 segmentTangent = (v_segmentEnd - v_segmentStart) / segmentLength;
877
+ float segmentLengthPx = length(v_segmentEndPx - v_segmentStartPx);
878
+ segmentLengthPx = max(segmentLengthPx, 1.17549429e-38); // avoid divide by zero
879
+ vec2 segmentTangent = (v_segmentEndPx - v_segmentStartPx) / segmentLengthPx;
841
880
  vec2 segmentNormal = vec2(-segmentTangent.y, segmentTangent.x);
842
- vec2 startToPoint = currentPoint - v_segmentStart;
843
- float lengthToPoint = max(0., min(dot(segmentTangent, startToPoint), segmentLength));
844
- float currentLengthPx = lengthToPoint + v_distanceOffsetPx;
845
- float currentRadiusPx = distanceFromSegment(currentPoint, v_segmentStart, v_segmentEnd);
846
- float currentRadiusRatio = dot(segmentNormal, startToPoint) * 2. / v_width;
847
- currentLineMetric = mix(
848
- v_measureStart,
849
- v_measureEnd,
850
- lengthToPoint / max(segmentLength, 1.17549429e-38)
851
- );
881
+ vec2 startToPointPx = currentPointPx - v_segmentStartPx;
882
+ float lengthToPointPx = max(0., min(dot(segmentTangent, startToPointPx), segmentLengthPx));
883
+ float currentLengthPx = lengthToPointPx + v_distancePx;
884
+ float currentRadiusPx = distanceFromSegment(currentPointPx, v_segmentStartPx, v_segmentEndPx);
885
+ float currentRadiusRatio = dot(segmentNormal, startToPointPx) * 2. / v_width;
886
+ currentLineMetric = mix(v_measureStart, v_measureEnd, lengthToPointPx / segmentLengthPx);
852
887
 
853
888
  if (${this.discardExpression_}) { discard; }
854
889
 
855
890
  float capType = ${this.strokeCapExpression_};
856
891
  float joinType = ${this.strokeJoinExpression_};
857
- float segmentStartDistance = computeSegmentPointDistance(currentPoint, v_segmentStart, v_segmentEnd, v_width, v_angleStart, capType, joinType);
858
- float segmentEndDistance = computeSegmentPointDistance(currentPoint, v_segmentEnd, v_segmentStart, v_width, v_angleEnd, capType, joinType);
892
+ float segmentStartDistance = computeSegmentPointDistance(currentPointPx, v_segmentStartPx, v_segmentEndPx, v_width, v_angleStart, capType, joinType);
893
+ float segmentEndDistance = computeSegmentPointDistance(currentPointPx, v_segmentEndPx, v_segmentStartPx, v_width, v_angleEnd, capType, joinType);
859
894
  float distanceField = max(
860
- segmentDistanceField(currentPoint, v_segmentStart, v_segmentEnd, v_width),
895
+ segmentDistanceField(currentPointPx, v_segmentStartPx, v_segmentEndPx, v_width),
861
896
  max(segmentStartDistance, segmentEndDistance)
862
897
  );
863
898
  distanceField = max(distanceField, ${this.strokeDistanceFieldExpression_});
@@ -19,7 +19,8 @@ export namespace Attributes {
19
19
  let MEASURE_END: string;
20
20
  let ANGLE_TANGENT_SUM: string;
21
21
  let JOIN_ANGLES: string;
22
- let DISTANCE: string;
22
+ let DISTANCE_LOW: string;
23
+ let DISTANCE_HIGH: string;
23
24
  }
24
25
  export default VectorStyleRenderer;
25
26
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"VectorStyleRenderer.d.ts","sourceRoot":"","sources":["VectorStyleRenderer.js"],"names":[],"mappings":"AAunBA;;;;;GAKG;AACH,6CAJW,aAAa,GAAC,YAAY,GAAC,KAAK,CAAC,YAAY,CAAC,aAC9C,OAAO,qBAAqB,EAAE,cAAc,GAC3C,KAAK,CAAC,YAAY,CAAC,CAuD9B;;;;;yBA/oBS,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;cAmBF,CAAS,IAAwD,EAAnD,OAAO,yBAAyB,EAAE,iBAAiB,EAAE,IAAmC,EAAnC,OAAO,eAAe,EAAE,WAAW,KAAE,MAAM,GAAC,KAAK,CA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 @@ export const Attributes = {
44
44
  MEASURE_END: 'a_measureEnd',
45
45
  ANGLE_TANGENT_SUM: 'a_angleTangentSum',
46
46
  JOIN_ANGLES: 'a_joinAngles',
47
- DISTANCE: 'a_distance',
47
+ DISTANCE_LOW: 'a_distanceLow',
48
+ DISTANCE_HIGH: 'a_distanceHigh',
48
49
  };
49
50
 
50
51
  /**
@@ -269,7 +270,12 @@ class VectorStyleRenderer {
269
270
  type: AttributeType.FLOAT,
270
271
  },
271
272
  {
272
- name: Attributes.DISTANCE,
273
+ name: Attributes.DISTANCE_LOW,
274
+ size: 1,
275
+ type: AttributeType.FLOAT,
276
+ },
277
+ {
278
+ name: Attributes.DISTANCE_HIGH,
273
279
  size: 1,
274
280
  type: AttributeType.FLOAT,
275
281
  },
@@ -1 +1 @@
1
- {"version":3,"file":"bufferUtil.d.ts","sourceRoot":"","sources":["bufferUtil.js"],"names":[],"mappings":"AA0BA;;;;;;;;;;;GAWG;AACH,yDAVW,YAAY,gBACZ,MAAM,4BACN,YAAY,wBACZ,MAAM,oBACN,eAAe,GACd,eAAe,CAmC1B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wDAbW,YAAY,qBACZ,MAAM,mBACN,MAAM,sBACN,MAAM,GAAC,IAAI,qBACX,MAAM,GAAC,IAAI,2BACX,KAAK,CAAC,MAAM,CAAC,oBACb,KAAK,CAAC,MAAM,CAAC,oBACb,OAAO,oBAAoB,EAAE,SAAS,iBACtC,MAAM,0BACN,MAAM,GACL;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,CA0H1C;AAED;;;;;;;;;GASG;AACH,6DARW,YAAY,qBACZ,MAAM,eACN,KAAK,CAAC,MAAM,CAAC,cACb,KAAK,CAAC,MAAM,CAAC,wBACb,MAAM,GACL,MAAM,CA0CjB;AAzQD,6CAA8C,KAAK,CAAC;;;;;;;;8BAQtC,MAAM;;;;gCACN,MAAM;;;;qBACN,MAAM"}
1
+ {"version":3,"file":"bufferUtil.d.ts","sourceRoot":"","sources":["bufferUtil.js"],"names":[],"mappings":"AA0BA;;;;;;;;;;;GAWG;AACH,yDAVW,YAAY,gBACZ,MAAM,4BACN,YAAY,wBACZ,MAAM,oBACN,eAAe,GACd,eAAe,CAmC1B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wDAbW,YAAY,qBACZ,MAAM,mBACN,MAAM,sBACN,MAAM,GAAC,IAAI,qBACX,MAAM,GAAC,IAAI,2BACX,KAAK,CAAC,MAAM,CAAC,oBACb,KAAK,CAAC,MAAM,CAAC,oBACb,OAAO,oBAAoB,EAAE,SAAS,iBACtC,MAAM,0BACN,MAAM,GACL;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,CAgI1C;AAED;;;;;;;;;GASG;AACH,6DARW,YAAY,qBACZ,MAAM,eACN,KAAK,CAAC,MAAM,CAAC,cACb,KAAK,CAAC,MAAM,CAAC,wBACb,MAAM,GACL,MAAM,CA0CjB;AA/QD,6CAA8C,KAAK,CAAC;;;;;;;;8BAQtC,MAAM;;;;gCACN,MAAM;;;;qBACN,MAAM"}
@@ -117,7 +117,7 @@ export function writeLineSegmentToBuffers(
117
117
  // Depending on whether there are points before and after the segment, its final shape
118
118
  // will be different
119
119
  const p0 = [
120
- instructions[segmentStartIndex + 0],
120
+ instructions[segmentStartIndex],
121
121
  instructions[segmentStartIndex + 1],
122
122
  ];
123
123
  const p1 = [instructions[segmentEndIndex], instructions[segmentEndIndex + 1]];
@@ -148,12 +148,13 @@ export function writeLineSegmentToBuffers(
148
148
  const tangentB = [(pB[0] - p0[0]) / lenB, (pB[1] - p0[1]) / lenB];
149
149
 
150
150
  // this angle can be clockwise or anticlockwise; hence the computation afterwards
151
- const angle =
151
+ let angle =
152
152
  lenA === 0 || lenB === 0
153
153
  ? 0
154
154
  : Math.acos(
155
155
  clamp(tangentB[0] * tangentA[0] + tangentB[1] * tangentA[1], -1, 1),
156
156
  );
157
+ angle = Math.max(angle, 0.00001); // avoid a zero angle otherwise this is detected as a line cap
157
158
  const isClockwise = tangentB[0] * orthoA[0] + tangentB[1] * orthoA[1] > 0;
158
159
  return !isClockwise ? Math.PI * 2 - angle : angle;
159
160
  }
@@ -197,6 +198,10 @@ export function writeLineSegmentToBuffers(
197
198
  }
198
199
  }
199
200
 
201
+ const maxPrecision = Math.pow(2, 24);
202
+ const distanceLow = currentLength % maxPrecision;
203
+ const distanceHigh = Math.floor(currentLength / maxPrecision) * maxPrecision;
204
+
200
205
  instanceAttributesArray.push(
201
206
  p0[0],
202
207
  p0[1],
@@ -206,7 +211,8 @@ export function writeLineSegmentToBuffers(
206
211
  m1,
207
212
  angle0,
208
213
  angle1,
209
- currentLength,
214
+ distanceLow,
215
+ distanceHigh,
210
216
  currentAngleTangentSum,
211
217
  );
212
218
  instanceAttributesArray.push(...customAttributes);
@@ -1 +1 @@
1
- {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["style.js"],"names":[],"mappings":"AA+BA;;;;GAIG;AACH,mCAHW,MAAO,MAAM,GACZ,MAAM,CAOjB;AAyrBD;;;;;GAKG;AAEH;;;;;;;;;;;;GAYG;AACH,yCALW,OAAO,qBAAqB,EAAE,SAAS,cACvC,OAAO,qBAAqB,EAAE,cAAc,WAC5C,OAAO,0BAA0B,EAAE,iBAAiB,GACnD,gBAAgB,CAyE3B;;;;;aAzFa,aAAa;;;;cACb,OAAO,0BAA0B,EAAE,kBAAkB;;;;gBACrD,OAAO,0BAA0B,EAAE,oBAAoB;;8BAjtBzC,oBAAoB"}
1
+ {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["style.js"],"names":[],"mappings":"AA+BA;;;;GAIG;AACH,mCAHW,MAAO,MAAM,GACZ,MAAM,CAOjB;AAytBD;;;;;GAKG;AAEH;;;;;;;;;;;;GAYG;AACH,yCALW,OAAO,qBAAqB,EAAE,SAAS,cACvC,OAAO,qBAAqB,EAAE,cAAc,WAC5C,OAAO,0BAA0B,EAAE,iBAAiB,GACnD,gBAAgB,CAyE3B;;;;;aAzFa,aAAa;;;;cACb,OAAO,0BAA0B,EAAE,kBAAkB;;;;gBACrD,OAAO,0BAA0B,EAAE,oBAAoB;;8BAjvBzC,oBAAoB"}
@@ -562,16 +562,26 @@ function parseStrokeProperties(style, builder, uniforms, context) {
562
562
  NumberType,
563
563
  );
564
564
  }
565
+ let startOffsetExpression = '0.';
566
+ if ('stroke-pattern-start-offset' in style) {
567
+ startOffsetExpression = expressionToGlsl(
568
+ context,
569
+ style['stroke-pattern-start-offset'],
570
+ NumberType,
571
+ );
572
+ }
565
573
  context.functions['sampleStrokePattern'] =
566
- `vec4 sampleStrokePattern(sampler2D texture, vec2 textureSize, vec2 textureOffset, vec2 sampleSize, float spacingPx, float currentLengthPx, float currentRadiusRatio, float lineWidth) {
567
- float currentLengthScaled = currentLengthPx * sampleSize.y / lineWidth;
574
+ `vec4 sampleStrokePattern(sampler2D texture, vec2 textureSize, vec2 textureOffset, vec2 sampleSize, float spacingPx, float startOffsetPx, float currentLengthPx, float currentRadiusRatio, float lineWidth) {
575
+ float currentLengthScaled = (currentLengthPx - startOffsetPx) * sampleSize.y / lineWidth;
568
576
  float spacingScaled = spacingPx * sampleSize.y / lineWidth;
569
577
  float uCoordPx = mod(currentLengthScaled, (sampleSize.x + spacingScaled));
578
+ float isInsideOfPattern = step(uCoordPx, sampleSize.x);
579
+ float vCoordPx = (-currentRadiusRatio * 0.5 + 0.5) * sampleSize.y;
570
580
  // make sure that we're not sampling too close to the borders to avoid interpolation with outside pixels
571
581
  uCoordPx = clamp(uCoordPx, 0.5, sampleSize.x - 0.5);
572
- float vCoordPx = (-currentRadiusRatio * 0.5 + 0.5) * sampleSize.y;
582
+ vCoordPx = clamp(vCoordPx, 0.5, sampleSize.y - 0.5);
573
583
  vec2 texCoord = (vec2(uCoordPx, vCoordPx) + textureOffset) / textureSize;
574
- return texture2D(texture, texCoord);
584
+ return texture2D(texture, texCoord) * vec4(1.0, 1.0, 1.0, isInsideOfPattern);
575
585
  }`;
576
586
  const textureName = `u_texture${textureId}`;
577
587
  let tintExpression = '1.';
@@ -579,7 +589,18 @@ function parseStrokeProperties(style, builder, uniforms, context) {
579
589
  tintExpression = builder.getStrokeColorExpression();
580
590
  }
581
591
  builder.setStrokeColorExpression(
582
- `${tintExpression} * sampleStrokePattern(${textureName}, ${sizeExpression}, ${offsetExpression}, ${sampleSizeExpression}, ${spacingExpression}, currentLengthPx, currentRadiusRatio, v_width)`,
592
+ `${tintExpression} * sampleStrokePattern(${textureName}, ${sizeExpression}, ${offsetExpression}, ${sampleSizeExpression}, ${spacingExpression}, ${startOffsetExpression}, currentLengthPx, currentRadiusRatio, v_width)`,
593
+ );
594
+
595
+ context.functions['computeStrokePatternLength'] =
596
+ `float computeStrokePatternLength(vec2 sampleSize, float spacingPx, float lineWidth) {
597
+ float patternLengthPx = sampleSize.x / sampleSize.y * lineWidth;
598
+ return patternLengthPx + spacingPx;
599
+ }`;
600
+
601
+ // apply a stroke pattern length to avoid visual artifacts
602
+ builder.setStrokePatternLengthExpression(
603
+ `computeStrokePatternLength(${sampleSizeExpression}, ${spacingExpression}, v_width)`,
583
604
  );
584
605
  }
585
606
 
@@ -672,6 +693,17 @@ function parseStrokeProperties(style, builder, uniforms, context) {
672
693
  builder.setStrokeDistanceFieldExpression(
673
694
  `${dashFunctionName}(currentLengthPx + ${offsetExpression}, currentRadiusPx, capType, v_width, ${dashLengthsCalls})`,
674
695
  );
696
+
697
+ // apply a stroke pattern length to avoid visual artifacts
698
+ let patternLength = dashPattern.join(' + ');
699
+ if (builder.getStrokePatternLengthExpression()) {
700
+ context.functions['combinePatternLengths'] =
701
+ `float combinePatternLengths(float patternLength1, float patternLength2) {
702
+ return patternLength1 * patternLength2;
703
+ }`;
704
+ patternLength = `combinePatternLengths(${builder.getStrokePatternLengthExpression()}, ${patternLength})`;
705
+ }
706
+ builder.setStrokePatternLengthExpression(patternLength);
675
707
  }
676
708
  }
677
709
 
package/style/flat.d.ts CHANGED
@@ -112,17 +112,18 @@
112
112
  * @property {NumberArrayExpression} [stroke-line-dash] Line dash pattern.
113
113
  * @property {NumberExpression} [stroke-line-dash-offset=0] Line dash offset.
114
114
  * @property {NumberExpression} [stroke-miter-limit=10] Miter limit.
115
- * @property {NumberExpression} [stroke-offset] Stroke offset in pixel. A positive value offsets the line to the right,
115
+ * @property {NumberExpression} [stroke-offset] Stroke offset in pixel along the normal. A positive value offsets the line to the right,
116
116
  * relative to the direction of the line. (WebGL only)
117
117
  * @property {string} [stroke-pattern-src] Stroke pattern image source URI. If `stroke-color` is defined as well,
118
118
  * it will be used to tint this image. (WebGL only)
119
119
  * @property {SizeExpression} [stroke-pattern-offset=[0, 0]] Offset, which, together with the size and the offset origin,
120
- * define the sub-rectangle to use from the original fill pattern image. (WebGL only)
120
+ * define the sub-rectangle to use from the original stroke pattern image. (WebGL only)
121
121
  * @property {import("./Icon.js").IconOrigin} [stroke-pattern-offset-origin='top-left'] Origin of the offset: `bottom-left`, `bottom-right`,
122
122
  * `top-left` or `top-right`. (WebGL only)
123
123
  * @property {SizeExpression} [stroke-pattern-size] Stroke pattern image size in pixel. Can be used together with `stroke-pattern-offset` to define the
124
124
  * sub-rectangle to use from the origin (sprite) fill pattern image. (WebGL only)
125
- * @property {NumberExpression} [stroke-pattern-spacing] Spacing between each pattern occurrence in pixels; 0 if undefined.
125
+ * @property {NumberExpression} [stroke-pattern-spacing] Spacing between each pattern occurrence in pixels; 0 if undefined. (WebGL only)
126
+ * @property {NumberExpression} [stroke-pattern-start-offset] Stroke pattern offset in pixels at the start of the line. (WebGL only)
126
127
  * @property {NumberExpression} [z-index] The zIndex of the style.
127
128
  */
128
129
  /**
@@ -376,7 +377,7 @@ export type FlatStroke = {
376
377
  */
377
378
  "stroke-miter-limit"?: NumberExpression | undefined;
378
379
  /**
379
- * Stroke offset in pixel. A positive value offsets the line to the right,
380
+ * Stroke offset in pixel along the normal. A positive value offsets the line to the right,
380
381
  * relative to the direction of the line. (WebGL only)
381
382
  */
382
383
  "stroke-offset"?: NumberExpression | undefined;
@@ -387,7 +388,7 @@ export type FlatStroke = {
387
388
  "stroke-pattern-src"?: string | undefined;
388
389
  /**
389
390
  * Offset, which, together with the size and the offset origin,
390
- * define the sub-rectangle to use from the original fill pattern image. (WebGL only)
391
+ * define the sub-rectangle to use from the original stroke pattern image. (WebGL only)
391
392
  */
392
393
  "stroke-pattern-offset"?: SizeExpression | undefined;
393
394
  /**
@@ -401,9 +402,13 @@ export type FlatStroke = {
401
402
  */
402
403
  "stroke-pattern-size"?: SizeExpression | undefined;
403
404
  /**
404
- * Spacing between each pattern occurrence in pixels; 0 if undefined.
405
+ * Spacing between each pattern occurrence in pixels; 0 if undefined. (WebGL only)
405
406
  */
406
407
  "stroke-pattern-spacing"?: NumberExpression | undefined;
408
+ /**
409
+ * Stroke pattern offset in pixels at the start of the line. (WebGL only)
410
+ */
411
+ "stroke-pattern-start-offset"?: NumberExpression | undefined;
407
412
  /**
408
413
  * The zIndex of the style.
409
414
  */
@@ -1 +1 @@
1
- {"version":3,"file":"flat.d.ts","sourceRoot":"","sources":["flat.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH;;;;GAIG;AAEH;;;;GAIG;AAEH;;;;GAIG;AAEH;;;;;GAKG;AAEH;;;;GAIG;AAEH;;;;GAIG;AAEH;;;;;;GAMG;AAEH;;;;GAIG;AAEH;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA+LrC,MAAM;;;;oBACN,MAAM;;;;oBACN,MAAM;;;;qBACN,MAAM;;;;yBACN,MAAM;;;;2BACN,MAAM;;;;2BACN,MAAM;;;;;;;;;;WAuBN,SAAS,GAAC,KAAK,CAAC,SAAS,CAAC"}
package/style/flat.js CHANGED
@@ -123,17 +123,18 @@
123
123
  * @property {NumberArrayExpression} [stroke-line-dash] Line dash pattern.
124
124
  * @property {NumberExpression} [stroke-line-dash-offset=0] Line dash offset.
125
125
  * @property {NumberExpression} [stroke-miter-limit=10] Miter limit.
126
- * @property {NumberExpression} [stroke-offset] Stroke offset in pixel. A positive value offsets the line to the right,
126
+ * @property {NumberExpression} [stroke-offset] Stroke offset in pixel along the normal. A positive value offsets the line to the right,
127
127
  * relative to the direction of the line. (WebGL only)
128
128
  * @property {string} [stroke-pattern-src] Stroke pattern image source URI. If `stroke-color` is defined as well,
129
129
  * it will be used to tint this image. (WebGL only)
130
130
  * @property {SizeExpression} [stroke-pattern-offset=[0, 0]] Offset, which, together with the size and the offset origin,
131
- * define the sub-rectangle to use from the original fill pattern image. (WebGL only)
131
+ * define the sub-rectangle to use from the original stroke pattern image. (WebGL only)
132
132
  * @property {import("./Icon.js").IconOrigin} [stroke-pattern-offset-origin='top-left'] Origin of the offset: `bottom-left`, `bottom-right`,
133
133
  * `top-left` or `top-right`. (WebGL only)
134
134
  * @property {SizeExpression} [stroke-pattern-size] Stroke pattern image size in pixel. Can be used together with `stroke-pattern-offset` to define the
135
135
  * sub-rectangle to use from the origin (sprite) fill pattern image. (WebGL only)
136
- * @property {NumberExpression} [stroke-pattern-spacing] Spacing between each pattern occurrence in pixels; 0 if undefined.
136
+ * @property {NumberExpression} [stroke-pattern-spacing] Spacing between each pattern occurrence in pixels; 0 if undefined. (WebGL only)
137
+ * @property {NumberExpression} [stroke-pattern-start-offset] Stroke pattern offset in pixels at the start of the line. (WebGL only)
137
138
  * @property {NumberExpression} [z-index] The zIndex of the style.
138
139
  */
139
140
 
package/util.js CHANGED
@@ -33,4 +33,4 @@ export function getUid(obj) {
33
33
  * OpenLayers version.
34
34
  * @type {string}
35
35
  */
36
- export const VERSION = '10.6.2-dev.1754333306603';
36
+ export const VERSION = '10.6.2-dev.1754660719063';
package/worker/webgl.js CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  export function create() {
3
- const source = "function t(t,n,x=2){const i=n&&n.length,o=i?n[0]*x:t.length;let f=e(t,0,o,x,!0);const l=[];if(!f||f.next===f.prev)return l;let c,y,h;if(i&&(f=function(t,n,r,x){const i=[];for(let r=0,o=n.length;r<o;r++){const f=e(t,n[r]*x,r<o-1?n[r+1]*x:t.length,x,!1);f===f.next&&(f.steiner=!0),i.push(a(f))}i.sort(u);for(let t=0;t<i.length;t++)r=s(i[t],r);return r}(t,n,f,x)),t.length>80*x){c=t[0],y=t[1];let e=c,n=y;for(let r=x;r<o;r+=x){const x=t[r],i=t[r+1];x<c&&(c=x),i<y&&(y=i),x>e&&(e=x),i>n&&(n=i)}h=Math.max(e-c,n-y),h=0!==h?32767/h:0}return r(f,l,x,c,y,h,0),l}function e(t,e,n,r,x){let i;if(x===function(t,e,n,r){let x=0;for(let i=e,o=n-r;i<n;i+=r)x+=(t[o]-t[i])*(t[i+1]+t[o+1]),o=i;return x}(t,e,n,r)>0)for(let x=e;x<n;x+=r)i=d(x/r|0,t[x],t[x+1],i);else for(let x=n-r;x>=e;x-=r)i=d(x/r|0,t[x],t[x+1],i);return i&&b(i,i.next)&&(w(i),i=i.next),i}function n(t,e){if(!t)return t;e||(e=t);let n,r=t;do{if(n=!1,r.steiner||!b(r,r.next)&&0!==v(r.prev,r,r.next))r=r.next;else{if(w(r),r=e=r.prev,r===r.next)break;n=!0}}while(n||r!==e);return e}function r(t,e,u,s,l,a,y){if(!t)return;!y&&a&&function(t,e,n,r){let x=t;do{0===x.z&&(x.z=c(x.x,x.y,e,n,r)),x.prevZ=x.prev,x.nextZ=x.next,x=x.next}while(x!==t);x.prevZ.nextZ=null,x.prevZ=null,function(t){let e,n=1;do{let r,x=t;t=null;let i=null;for(e=0;x;){e++;let o=x,f=0;for(let t=0;t<n&&(f++,o=o.nextZ,o);t++);let u=n;for(;f>0||u>0&&o;)0!==f&&(0===u||!o||x.z<=o.z)?(r=x,x=x.nextZ,f--):(r=o,o=o.nextZ,u--),i?i.nextZ=r:t=r,r.prevZ=i,i=r;x=o}i.nextZ=null,n*=2}while(e>1)}(x)}(t,s,l,a);let h=t;for(;t.prev!==t.next;){const c=t.prev,p=t.next;if(a?i(t,s,l,a):x(t))e.push(c.i,t.i,p.i),w(t),t=p.next,h=p.next;else if((t=p)===h){y?1===y?r(t=o(n(t),e),e,u,s,l,a,2):2===y&&f(t,e,u,s,l,a):r(n(t),e,u,s,l,a,1);break}}}function x(t){const e=t.prev,n=t,r=t.next;if(v(e,n,r)>=0)return!1;const x=e.x,i=n.x,o=r.x,f=e.y,u=n.y,s=r.y,l=Math.min(x,i,o),c=Math.min(f,u,s),a=Math.max(x,i,o),y=Math.max(f,u,s);let p=r.next;for(;p!==e;){if(p.x>=l&&p.x<=a&&p.y>=c&&p.y<=y&&h(x,f,i,u,o,s,p.x,p.y)&&v(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function i(t,e,n,r){const x=t.prev,i=t,o=t.next;if(v(x,i,o)>=0)return!1;const f=x.x,u=i.x,s=o.x,l=x.y,a=i.y,y=o.y,p=Math.min(f,u,s),b=Math.min(l,a,y),m=Math.max(f,u,s),A=Math.max(l,a,y),M=c(p,b,e,n,r),g=c(m,A,e,n,r);let Z=t.prevZ,d=t.nextZ;for(;Z&&Z.z>=M&&d&&d.z<=g;){if(Z.x>=p&&Z.x<=m&&Z.y>=b&&Z.y<=A&&Z!==x&&Z!==o&&h(f,l,u,a,s,y,Z.x,Z.y)&&v(Z.prev,Z,Z.next)>=0)return!1;if(Z=Z.prevZ,d.x>=p&&d.x<=m&&d.y>=b&&d.y<=A&&d!==x&&d!==o&&h(f,l,u,a,s,y,d.x,d.y)&&v(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;Z&&Z.z>=M;){if(Z.x>=p&&Z.x<=m&&Z.y>=b&&Z.y<=A&&Z!==x&&Z!==o&&h(f,l,u,a,s,y,Z.x,Z.y)&&v(Z.prev,Z,Z.next)>=0)return!1;Z=Z.prevZ}for(;d&&d.z<=g;){if(d.x>=p&&d.x<=m&&d.y>=b&&d.y<=A&&d!==x&&d!==o&&h(f,l,u,a,s,y,d.x,d.y)&&v(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function o(t,e){let r=t;do{const n=r.prev,x=r.next.next;!b(n,x)&&m(n,r,r.next,x)&&g(n,x)&&g(x,n)&&(e.push(n.i,r.i,x.i),w(r),w(r.next),r=t=x),r=r.next}while(r!==t);return n(r)}function f(t,e,x,i,o,f){let u=t;do{let t=u.next.next;for(;t!==u.prev;){if(u.i!==t.i&&p(u,t)){let s=Z(u,t);return u=n(u,u.next),s=n(s,s.next),r(u,e,x,i,o,f,0),void r(s,e,x,i,o,f,0)}t=t.next}u=u.next}while(u!==t)}function u(t,e){let n=t.x-e.x;if(0===n&&(n=t.y-e.y,0===n)){n=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)}return n}function s(t,e){const r=function(t,e){let n=e;const r=t.x,x=t.y;let i,o=-1/0;if(b(t,n))return n;do{if(b(t,n.next))return n.next;if(x<=n.y&&x>=n.next.y&&n.next.y!==n.y){const t=n.x+(x-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=r&&t>o&&(o=t,i=n.x<n.next.x?n:n.next,t===r))return i}n=n.next}while(n!==e);if(!i)return null;const f=i,u=i.x,s=i.y;let c=1/0;n=i;do{if(r>=n.x&&n.x>=u&&r!==n.x&&y(x<s?r:o,x,u,s,x<s?o:r,x,n.x,n.y)){const e=Math.abs(x-n.y)/(r-n.x);g(n,t)&&(e<c||e===c&&(n.x>i.x||n.x===i.x&&l(i,n)))&&(i=n,c=e)}n=n.next}while(n!==f);return i}(t,e);if(!r)return e;const x=Z(r,t);return n(x,x.next),n(r,r.next)}function l(t,e){return v(t.prev,t,e.prev)<0&&v(e.next,t,t.next)<0}function c(t,e,n,r,x){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*x|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*x|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function a(t){let e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function y(t,e,n,r,x,i,o,f){return(x-o)*(e-f)>=(t-o)*(i-f)&&(t-o)*(r-f)>=(n-o)*(e-f)&&(n-o)*(i-f)>=(x-o)*(r-f)}function h(t,e,n,r,x,i,o,f){return!(t===o&&e===f)&&y(t,e,n,r,x,i,o,f)}function p(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&m(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(g(t,e)&&g(e,t)&&function(t,e){let n=t,r=!1;const x=(t.x+e.x)/2,i=(t.y+e.y)/2;do{n.y>i!=n.next.y>i&&n.next.y!==n.y&&x<(n.next.x-n.x)*(i-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)&&(v(t.prev,t,e.prev)||v(t,e.prev,e))||b(t,e)&&v(t.prev,t,t.next)>0&&v(e.prev,e,e.next)>0)}function v(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function b(t,e){return t.x===e.x&&t.y===e.y}function m(t,e,n,r){const x=M(v(t,e,n)),i=M(v(t,e,r)),o=M(v(n,r,t)),f=M(v(n,r,e));return x!==i&&o!==f||(!(0!==x||!A(t,n,e))||(!(0!==i||!A(t,r,e))||(!(0!==o||!A(n,t,r))||!(0!==f||!A(n,e,r)))))}function A(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function M(t){return t>0?1:t<0?-1:0}function g(t,e){return v(t.prev,t,t.next)<0?v(t,e,t.next)>=0&&v(t,t.prev,e)>=0:v(t,e,t.prev)<0||v(t,t.next,e)<0}function Z(t,e){const n=F(t.i,t.x,t.y),r=F(e.i,e.x,e.y),x=t.next,i=e.prev;return t.next=e,e.prev=t,n.next=x,x.prev=n,r.next=n,n.prev=r,i.next=r,r.prev=i,r}function d(t,e,n,r){const x=F(t,e,n);return r?(x.next=r.next,x.prev=r,r.next.prev=x,r.next=x):(x.prev=x,x.next=x),x}function w(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function F(t,e,n){return{i:t,x:e,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function E(t,e){const n=e[0],r=e[1];return e[0]=t[0]*n+t[2]*r+t[4],e[1]=t[1]*n+t[3]*r+t[5],e}function I(t,e){const n=(r=e)[0]*r[3]-r[1]*r[2];var r;!function(t,e){if(!t)throw new Error(e)}(0!==n,\"Transformation matrix cannot be inverted\");const x=e[0],i=e[1],o=e[2],f=e[3],u=e[4],s=e[5];return t[0]=f/n,t[1]=-i/n,t[2]=-o/n,t[3]=x/n,t[4]=(o*s-f*u)/n,t[5]=-(x*s-i*u)/n,t}new Array(6);const z=[],B={vertexAttributesPosition:0,instanceAttributesPosition:0,indicesPosition:0};function P(t,e,n,r,x){const i=t[e++],o=t[e++],f=z;f.length=r;for(let n=0;n<f.length;n++)f[n]=t[e+n];let u=x?x.instanceAttributesPosition:0;return n[u++]=i,n[u++]=o,f.length&&(n.set(f,u),u+=f.length),B.instanceAttributesPosition=u,B}function N(t,e,n,r,x,i,o,f,u,s){const l=[t[e+0],t[e+1]],c=[t[n],t[n+1]],a=t[e+2],y=t[n+2],h=E(f,[...l]),p=E(f,[...c]);function v(t,e,n){const r=Math.sqrt((e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1])),x=[(e[0]-t[0])/r,(e[1]-t[1])/r],i=[-x[1],x[0]],o=Math.sqrt((n[0]-t[0])*(n[0]-t[0])+(n[1]-t[1])*(n[1]-t[1])),f=[(n[0]-t[0])/o,(n[1]-t[1])/o],u=0===r||0===o?0:Math.acos((s=f[0]*x[0]+f[1]*x[1],l=-1,c=1,Math.min(Math.max(s,l),c)));var s,l,c;return f[0]*i[0]+f[1]*i[1]>0?u:2*Math.PI-u}let b=-1,m=-1,A=s;const M=null!==x;if(null!==r){b=v(h,p,E(f,[...[t[r],t[r+1]]])),Math.cos(b)<=.985&&(A+=Math.tan((b-Math.PI)/2))}if(M){m=v(p,h,E(f,[...[t[x],t[x+1]]])),Math.cos(m)<=.985&&(A+=Math.tan((Math.PI-m)/2))}return i.push(l[0],l[1],a,c[0],c[1],y,b,m,u,s),i.push(...o),{length:u+Math.sqrt((p[0]-h[0])*(p[0]-h[0])+(p[1]-h[1])*(p[1]-h[1])),angle:A}}function R(e,n,r,x,i){const o=2+i;let f=n;const u=e.slice(f,f+i);f+=i;const s=e[f++];let l=0;const c=new Array(s-1);for(let t=0;t<s;t++)l+=e[f++],t<s-1&&(c[t]=l);const a=e.slice(f,f+2*l),y=t(a,c,2);for(let t=0;t<y.length;t++)x.push(y[t]+r.length/o);for(let t=0;t<a.length;t+=2)r.push(a[t],a[t+1],...u);return f+2*l}const S=\"GENERATE_POLYGON_BUFFERS\",T=\"GENERATE_POINT_BUFFERS\",_=\"GENERATE_LINE_STRING_BUFFERS\",O=self;O.onmessage=t=>{const e=t.data;switch(e.type){case T:{const t=2,n=2,r=e.customAttributesSize,x=n+r,i=new Float32Array(e.renderInstructions),o=i.length/x*(t+r),f=Uint32Array.from([0,1,3,1,2,3]),u=Float32Array.from([-1,-1,1,-1,1,1,-1,1]),s=new Float32Array(o);let l;for(let t=0;t<i.length;t+=x)l=P(i,t,s,r,l);const c=Object.assign({indicesBuffer:f.buffer,vertexAttributesBuffer:u.buffer,instanceAttributesBuffer:s.buffer,renderInstructions:i.buffer},e);O.postMessage(c,[u.buffer,s.buffer,f.buffer,i.buffer]);break}case _:{const t=[],n=e.customAttributesSize,r=3,x=new Float32Array(e.renderInstructions);let i=0;const o=[1,0,0,1,0,0];let f,u;for(I(o,e.renderInstructionsTransform);i<x.length;){u=Array.from(x.slice(i,i+n)),i+=n,f=x[i++];const e=i,s=i+(f-1)*r,l=x[e]===x[s]&&x[e+1]===x[s+1];let c=0,a=0;for(let n=0;n<f-1;n++){let y=null;n>0?y=i+(n-1)*r:l&&(y=s-r);let h=null;n<f-2?h=i+(n+2)*r:l&&(h=e+r);const p=N(x,i+n*r,i+(n+1)*r,y,h,t,u,o,c,a);c=p.length,a=p.angle}i+=f*r}const s=Uint32Array.from([0,1,3,1,2,3]),l=Float32Array.from([-1,-1,1,-1,1,1,-1,1]),c=Float32Array.from(t),a=Object.assign({indicesBuffer:s.buffer,vertexAttributesBuffer:l.buffer,instanceAttributesBuffer:c.buffer,renderInstructions:x.buffer},e);O.postMessage(a,[l.buffer,c.buffer,s.buffer,x.buffer]);break}case S:{const t=[],n=[],r=e.customAttributesSize,x=new Float32Array(e.renderInstructions);let i=0;for(;i<x.length;)i=R(x,i,t,n,r);const o=Uint32Array.from(n),f=Float32Array.from(t),u=Float32Array.from([]),s=Object.assign({indicesBuffer:o.buffer,vertexAttributesBuffer:f.buffer,instanceAttributesBuffer:u.buffer,renderInstructions:x.buffer},e);O.postMessage(s,[f.buffer,u.buffer,o.buffer,x.buffer]);break}}};";
3
+ const source = "function t(t,n,x=2){const o=n&&n.length,i=o?n[0]*x:t.length;let f=e(t,0,i,x,!0);const l=[];if(!f||f.next===f.prev)return l;let c,y,h;if(o&&(f=function(t,n,r,x){const o=[];for(let r=0,i=n.length;r<i;r++){const f=e(t,n[r]*x,r<i-1?n[r+1]*x:t.length,x,!1);f===f.next&&(f.steiner=!0),o.push(a(f))}o.sort(u);for(let t=0;t<o.length;t++)r=s(o[t],r);return r}(t,n,f,x)),t.length>80*x){c=t[0],y=t[1];let e=c,n=y;for(let r=x;r<i;r+=x){const x=t[r],o=t[r+1];x<c&&(c=x),o<y&&(y=o),x>e&&(e=x),o>n&&(n=o)}h=Math.max(e-c,n-y),h=0!==h?32767/h:0}return r(f,l,x,c,y,h,0),l}function e(t,e,n,r,x){let o;if(x===function(t,e,n,r){let x=0;for(let o=e,i=n-r;o<n;o+=r)x+=(t[i]-t[o])*(t[o+1]+t[i+1]),i=o;return x}(t,e,n,r)>0)for(let x=e;x<n;x+=r)o=d(x/r|0,t[x],t[x+1],o);else for(let x=n-r;x>=e;x-=r)o=d(x/r|0,t[x],t[x+1],o);return o&&b(o,o.next)&&(w(o),o=o.next),o}function n(t,e){if(!t)return t;e||(e=t);let n,r=t;do{if(n=!1,r.steiner||!b(r,r.next)&&0!==v(r.prev,r,r.next))r=r.next;else{if(w(r),r=e=r.prev,r===r.next)break;n=!0}}while(n||r!==e);return e}function r(t,e,u,s,l,a,y){if(!t)return;!y&&a&&function(t,e,n,r){let x=t;do{0===x.z&&(x.z=c(x.x,x.y,e,n,r)),x.prevZ=x.prev,x.nextZ=x.next,x=x.next}while(x!==t);x.prevZ.nextZ=null,x.prevZ=null,function(t){let e,n=1;do{let r,x=t;t=null;let o=null;for(e=0;x;){e++;let i=x,f=0;for(let t=0;t<n&&(f++,i=i.nextZ,i);t++);let u=n;for(;f>0||u>0&&i;)0!==f&&(0===u||!i||x.z<=i.z)?(r=x,x=x.nextZ,f--):(r=i,i=i.nextZ,u--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;x=i}o.nextZ=null,n*=2}while(e>1)}(x)}(t,s,l,a);let h=t;for(;t.prev!==t.next;){const c=t.prev,p=t.next;if(a?o(t,s,l,a):x(t))e.push(c.i,t.i,p.i),w(t),t=p.next,h=p.next;else if((t=p)===h){y?1===y?r(t=i(n(t),e),e,u,s,l,a,2):2===y&&f(t,e,u,s,l,a):r(n(t),e,u,s,l,a,1);break}}}function x(t){const e=t.prev,n=t,r=t.next;if(v(e,n,r)>=0)return!1;const x=e.x,o=n.x,i=r.x,f=e.y,u=n.y,s=r.y,l=Math.min(x,o,i),c=Math.min(f,u,s),a=Math.max(x,o,i),y=Math.max(f,u,s);let p=r.next;for(;p!==e;){if(p.x>=l&&p.x<=a&&p.y>=c&&p.y<=y&&h(x,f,o,u,i,s,p.x,p.y)&&v(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function o(t,e,n,r){const x=t.prev,o=t,i=t.next;if(v(x,o,i)>=0)return!1;const f=x.x,u=o.x,s=i.x,l=x.y,a=o.y,y=i.y,p=Math.min(f,u,s),b=Math.min(l,a,y),M=Math.max(f,u,s),m=Math.max(l,a,y),A=c(p,b,e,n,r),g=c(M,m,e,n,r);let Z=t.prevZ,d=t.nextZ;for(;Z&&Z.z>=A&&d&&d.z<=g;){if(Z.x>=p&&Z.x<=M&&Z.y>=b&&Z.y<=m&&Z!==x&&Z!==i&&h(f,l,u,a,s,y,Z.x,Z.y)&&v(Z.prev,Z,Z.next)>=0)return!1;if(Z=Z.prevZ,d.x>=p&&d.x<=M&&d.y>=b&&d.y<=m&&d!==x&&d!==i&&h(f,l,u,a,s,y,d.x,d.y)&&v(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;Z&&Z.z>=A;){if(Z.x>=p&&Z.x<=M&&Z.y>=b&&Z.y<=m&&Z!==x&&Z!==i&&h(f,l,u,a,s,y,Z.x,Z.y)&&v(Z.prev,Z,Z.next)>=0)return!1;Z=Z.prevZ}for(;d&&d.z<=g;){if(d.x>=p&&d.x<=M&&d.y>=b&&d.y<=m&&d!==x&&d!==i&&h(f,l,u,a,s,y,d.x,d.y)&&v(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function i(t,e){let r=t;do{const n=r.prev,x=r.next.next;!b(n,x)&&M(n,r,r.next,x)&&g(n,x)&&g(x,n)&&(e.push(n.i,r.i,x.i),w(r),w(r.next),r=t=x),r=r.next}while(r!==t);return n(r)}function f(t,e,x,o,i,f){let u=t;do{let t=u.next.next;for(;t!==u.prev;){if(u.i!==t.i&&p(u,t)){let s=Z(u,t);return u=n(u,u.next),s=n(s,s.next),r(u,e,x,o,i,f,0),void r(s,e,x,o,i,f,0)}t=t.next}u=u.next}while(u!==t)}function u(t,e){let n=t.x-e.x;if(0===n&&(n=t.y-e.y,0===n)){n=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)}return n}function s(t,e){const r=function(t,e){let n=e;const r=t.x,x=t.y;let o,i=-1/0;if(b(t,n))return n;do{if(b(t,n.next))return n.next;if(x<=n.y&&x>=n.next.y&&n.next.y!==n.y){const t=n.x+(x-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=r&&t>i&&(i=t,o=n.x<n.next.x?n:n.next,t===r))return o}n=n.next}while(n!==e);if(!o)return null;const f=o,u=o.x,s=o.y;let c=1/0;n=o;do{if(r>=n.x&&n.x>=u&&r!==n.x&&y(x<s?r:i,x,u,s,x<s?i:r,x,n.x,n.y)){const e=Math.abs(x-n.y)/(r-n.x);g(n,t)&&(e<c||e===c&&(n.x>o.x||n.x===o.x&&l(o,n)))&&(o=n,c=e)}n=n.next}while(n!==f);return o}(t,e);if(!r)return e;const x=Z(r,t);return n(x,x.next),n(r,r.next)}function l(t,e){return v(t.prev,t,e.prev)<0&&v(e.next,t,t.next)<0}function c(t,e,n,r,x){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*x|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*x|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function a(t){let e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function y(t,e,n,r,x,o,i,f){return(x-i)*(e-f)>=(t-i)*(o-f)&&(t-i)*(r-f)>=(n-i)*(e-f)&&(n-i)*(o-f)>=(x-i)*(r-f)}function h(t,e,n,r,x,o,i,f){return!(t===i&&e===f)&&y(t,e,n,r,x,o,i,f)}function p(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&M(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(g(t,e)&&g(e,t)&&function(t,e){let n=t,r=!1;const x=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&x<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)&&(v(t.prev,t,e.prev)||v(t,e.prev,e))||b(t,e)&&v(t.prev,t,t.next)>0&&v(e.prev,e,e.next)>0)}function v(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function b(t,e){return t.x===e.x&&t.y===e.y}function M(t,e,n,r){const x=A(v(t,e,n)),o=A(v(t,e,r)),i=A(v(n,r,t)),f=A(v(n,r,e));return x!==o&&i!==f||(!(0!==x||!m(t,n,e))||(!(0!==o||!m(t,r,e))||(!(0!==i||!m(n,t,r))||!(0!==f||!m(n,e,r)))))}function m(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function A(t){return t>0?1:t<0?-1:0}function g(t,e){return v(t.prev,t,t.next)<0?v(t,e,t.next)>=0&&v(t,t.prev,e)>=0:v(t,e,t.prev)<0||v(t,t.next,e)<0}function Z(t,e){const n=F(t.i,t.x,t.y),r=F(e.i,e.x,e.y),x=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=x,x.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function d(t,e,n,r){const x=F(t,e,n);return r?(x.next=r.next,x.prev=r,r.next.prev=x,r.next=x):(x.prev=x,x.next=x),x}function w(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function F(t,e,n){return{i:t,x:e,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function E(t,e){const n=e[0],r=e[1];return e[0]=t[0]*n+t[2]*r+t[4],e[1]=t[1]*n+t[3]*r+t[5],e}function I(t,e){const n=(r=e)[0]*r[3]-r[1]*r[2];var r;!function(t,e){if(!t)throw new Error(e)}(0!==n,\"Transformation matrix cannot be inverted\");const x=e[0],o=e[1],i=e[2],f=e[3],u=e[4],s=e[5];return t[0]=f/n,t[1]=-o/n,t[2]=-i/n,t[3]=x/n,t[4]=(i*s-f*u)/n,t[5]=-(x*s-o*u)/n,t}new Array(6);const z=[],B={vertexAttributesPosition:0,instanceAttributesPosition:0,indicesPosition:0};function P(t,e,n,r,x){const o=t[e++],i=t[e++],f=z;f.length=r;for(let n=0;n<f.length;n++)f[n]=t[e+n];let u=x?x.instanceAttributesPosition:0;return n[u++]=o,n[u++]=i,f.length&&(n.set(f,u),u+=f.length),B.instanceAttributesPosition=u,B}function N(t,e,n,r,x,o,i,f,u,s){const l=[t[e],t[e+1]],c=[t[n],t[n+1]],a=t[e+2],y=t[n+2],h=E(f,[...l]),p=E(f,[...c]);function v(t,e,n){const r=Math.sqrt((e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1])),x=[(e[0]-t[0])/r,(e[1]-t[1])/r],o=[-x[1],x[0]],i=Math.sqrt((n[0]-t[0])*(n[0]-t[0])+(n[1]-t[1])*(n[1]-t[1])),f=[(n[0]-t[0])/i,(n[1]-t[1])/i];let u=0===r||0===i?0:Math.acos((s=f[0]*x[0]+f[1]*x[1],l=-1,c=1,Math.min(Math.max(s,l),c)));var s,l,c;u=Math.max(u,1e-5);return f[0]*o[0]+f[1]*o[1]>0?u:2*Math.PI-u}let b=-1,M=-1,m=s;const A=null!==x;if(null!==r){b=v(h,p,E(f,[...[t[r],t[r+1]]])),Math.cos(b)<=.985&&(m+=Math.tan((b-Math.PI)/2))}if(A){M=v(p,h,E(f,[...[t[x],t[x+1]]])),Math.cos(M)<=.985&&(m+=Math.tan((Math.PI-M)/2))}const g=Math.pow(2,24),Z=u%g,d=Math.floor(u/g)*g;return o.push(l[0],l[1],a,c[0],c[1],y,b,M,Z,d,s),o.push(...i),{length:u+Math.sqrt((p[0]-h[0])*(p[0]-h[0])+(p[1]-h[1])*(p[1]-h[1])),angle:m}}function R(e,n,r,x,o){const i=2+o;let f=n;const u=e.slice(f,f+o);f+=o;const s=e[f++];let l=0;const c=new Array(s-1);for(let t=0;t<s;t++)l+=e[f++],t<s-1&&(c[t]=l);const a=e.slice(f,f+2*l),y=t(a,c,2);for(let t=0;t<y.length;t++)x.push(y[t]+r.length/i);for(let t=0;t<a.length;t+=2)r.push(a[t],a[t+1],...u);return f+2*l}const S=\"GENERATE_POLYGON_BUFFERS\",T=\"GENERATE_POINT_BUFFERS\",_=\"GENERATE_LINE_STRING_BUFFERS\",O=self;O.onmessage=t=>{const e=t.data;switch(e.type){case T:{const t=2,n=2,r=e.customAttributesSize,x=n+r,o=new Float32Array(e.renderInstructions),i=o.length/x*(t+r),f=Uint32Array.from([0,1,3,1,2,3]),u=Float32Array.from([-1,-1,1,-1,1,1,-1,1]),s=new Float32Array(i);let l;for(let t=0;t<o.length;t+=x)l=P(o,t,s,r,l);const c=Object.assign({indicesBuffer:f.buffer,vertexAttributesBuffer:u.buffer,instanceAttributesBuffer:s.buffer,renderInstructions:o.buffer},e);O.postMessage(c,[u.buffer,s.buffer,f.buffer,o.buffer]);break}case _:{const t=[],n=e.customAttributesSize,r=3,x=new Float32Array(e.renderInstructions);let o=0;const i=[1,0,0,1,0,0];let f,u;for(I(i,e.renderInstructionsTransform);o<x.length;){u=Array.from(x.slice(o,o+n)),o+=n,f=x[o++];const e=o,s=o+(f-1)*r,l=x[e]===x[s]&&x[e+1]===x[s+1];let c=0,a=0;for(let n=0;n<f-1;n++){let y=null;n>0?y=o+(n-1)*r:l&&(y=s-r);let h=null;n<f-2?h=o+(n+2)*r:l&&(h=e+r);const p=N(x,o+n*r,o+(n+1)*r,y,h,t,u,i,c,a);c=p.length,a=p.angle}o+=f*r}const s=Uint32Array.from([0,1,3,1,2,3]),l=Float32Array.from([-1,-1,1,-1,1,1,-1,1]),c=Float32Array.from(t),a=Object.assign({indicesBuffer:s.buffer,vertexAttributesBuffer:l.buffer,instanceAttributesBuffer:c.buffer,renderInstructions:x.buffer},e);O.postMessage(a,[l.buffer,c.buffer,s.buffer,x.buffer]);break}case S:{const t=[],n=[],r=e.customAttributesSize,x=new Float32Array(e.renderInstructions);let o=0;for(;o<x.length;)o=R(x,o,t,n,r);const i=Uint32Array.from(n),f=Float32Array.from(t),u=Float32Array.from([]),s=Object.assign({indicesBuffer:i.buffer,vertexAttributesBuffer:f.buffer,instanceAttributesBuffer:u.buffer,renderInstructions:x.buffer},e);O.postMessage(s,[f.buffer,u.buffer,i.buffer,x.buffer]);break}}};";
4
4
  return new Worker(typeof Blob === 'undefined'
5
5
  ? 'data:application/javascript;base64,' + Buffer.from(source, 'binary').toString('base64')
6
6
  : URL.createObjectURL(new Blob([source], {type: 'application/javascript'})));