maplibre-gl 3.2.1 → 3.2.2

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.
Files changed (72) hide show
  1. package/build/generate-struct-arrays.ts +3 -2
  2. package/dist/maplibre-gl-csp-worker.js +1 -1
  3. package/dist/maplibre-gl-csp-worker.js.map +1 -1
  4. package/dist/maplibre-gl-csp.js +1 -1
  5. package/dist/maplibre-gl-csp.js.map +1 -1
  6. package/dist/maplibre-gl-dev.js +150 -84
  7. package/dist/maplibre-gl-dev.js.map +1 -1
  8. package/dist/maplibre-gl.d.ts +67 -50
  9. package/dist/maplibre-gl.js +4 -4
  10. package/dist/maplibre-gl.js.map +1 -1
  11. package/package.json +18 -18
  12. package/src/data/array_types.g.ts +32 -10
  13. package/src/data/bucket/circle_bucket.ts +1 -0
  14. package/src/data/bucket/line_bucket.ts +1 -0
  15. package/src/data/bucket/symbol_bucket.ts +1 -0
  16. package/src/data/feature_index.ts +1 -0
  17. package/src/data/program_configuration.ts +1 -0
  18. package/src/data/segment.ts +2 -0
  19. package/src/geo/transform.ts +1 -0
  20. package/src/gl/context.ts +1 -0
  21. package/src/gl/framebuffer.ts +1 -0
  22. package/src/gl/index_buffer.ts +1 -0
  23. package/src/gl/render_pool.ts +2 -1
  24. package/src/gl/vertex_buffer.ts +1 -0
  25. package/src/render/image_atlas.ts +1 -0
  26. package/src/render/line_atlas.ts +1 -0
  27. package/src/render/painter.ts +1 -0
  28. package/src/render/program.ts +1 -0
  29. package/src/render/render_to_texture.ts +31 -14
  30. package/src/render/terrain.ts +3 -0
  31. package/src/render/texture.ts +1 -0
  32. package/src/render/uniform_binding.ts +2 -0
  33. package/src/render/vertex_array_object.ts +1 -0
  34. package/src/shaders/symbol_sdf.fragment.glsl +9 -3
  35. package/src/shaders/symbol_sdf.fragment.glsl.g.ts +1 -1
  36. package/src/source/canvas_source.ts +1 -3
  37. package/src/source/geojson_source.ts +1 -3
  38. package/src/source/image_source.ts +2 -4
  39. package/src/source/source_cache.ts +1 -0
  40. package/src/source/source_state.ts +1 -0
  41. package/src/source/terrain_source_cache.ts +1 -0
  42. package/src/source/tile.ts +1 -0
  43. package/src/source/tile_cache.ts +1 -1
  44. package/src/source/tile_id.ts +1 -0
  45. package/src/source/vector_tile_worker_source.test.ts +79 -0
  46. package/src/source/vector_tile_worker_source.ts +26 -1
  47. package/src/source/worker_source.ts +1 -0
  48. package/src/style/evaluation_parameters.ts +1 -0
  49. package/src/style/properties.ts +14 -0
  50. package/src/style/style.ts +1 -0
  51. package/src/style/style_glyph.ts +1 -0
  52. package/src/symbol/collision_index.ts +1 -0
  53. package/src/symbol/grid_index.ts +1 -0
  54. package/src/ui/camera.ts +8 -8
  55. package/src/ui/handler/box_zoom.ts +1 -3
  56. package/src/ui/handler/click_zoom.ts +1 -3
  57. package/src/ui/handler/keyboard.ts +1 -3
  58. package/src/ui/handler/scroll_zoom.ts +1 -3
  59. package/src/ui/handler/shim/dblclick_zoom.ts +1 -3
  60. package/src/ui/handler/shim/drag_pan.ts +1 -3
  61. package/src/ui/handler/shim/drag_rotate.ts +1 -3
  62. package/src/ui/handler/shim/two_fingers_touch.ts +1 -3
  63. package/src/ui/handler/transform-provider.ts +1 -0
  64. package/src/ui/handler/two_fingers_touch.ts +1 -3
  65. package/src/ui/map.ts +7 -6
  66. package/src/util/ajax.test.ts +33 -0
  67. package/src/util/ajax.ts +5 -0
  68. package/src/util/image.ts +1 -0
  69. package/src/util/image_request.ts +2 -2
  70. package/src/util/performance.ts +1 -2
  71. package/src/util/struct_array.ts +5 -1
  72. package/src/util/test/mock_fetch.ts +51 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "maplibre-gl",
3
3
  "description": "BSD licensed community fork of mapbox-gl, a WebGL interactive maps library",
4
- "version": "3.2.1",
4
+ "version": "3.2.2",
5
5
  "main": "dist/maplibre-gl.js",
6
6
  "style": "dist/maplibre-gl.css",
7
7
  "license": "BSD-3-Clause",
@@ -54,7 +54,7 @@
54
54
  "@types/d3": "^7.4.0",
55
55
  "@types/diff": "^5.0.3",
56
56
  "@types/earcut": "^2.1.1",
57
- "@types/eslint": "^8.44.0",
57
+ "@types/eslint": "^8.44.1",
58
58
  "@types/gl": "^6.0.2",
59
59
  "@types/glob": "^8.1.0",
60
60
  "@types/jest": "^29.5.3",
@@ -62,40 +62,40 @@
62
62
  "@types/minimist": "^1.2.2",
63
63
  "@types/murmurhash-js": "^1.0.4",
64
64
  "@types/nise": "^1.4.1",
65
- "@types/node": "^20.4.4",
65
+ "@types/node": "^20.4.5",
66
66
  "@types/offscreencanvas": "^2019.7.0",
67
67
  "@types/pixelmatch": "^5.2.4",
68
68
  "@types/pngjs": "^6.0.1",
69
- "@types/react": "^18.2.15",
69
+ "@types/react": "^18.2.17",
70
70
  "@types/react-dom": "^18.2.7",
71
71
  "@types/request": "^2.48.8",
72
72
  "@types/shuffle-seed": "^1.1.0",
73
73
  "@types/window-or-global": "^1.0.4",
74
- "@typescript-eslint/eslint-plugin": "^5.61.0",
75
- "@typescript-eslint/parser": "^5.62.0",
74
+ "@typescript-eslint/eslint-plugin": "^6.2.0",
75
+ "@typescript-eslint/parser": "^6.2.0",
76
76
  "address": "^1.2.2",
77
77
  "benchmark": "^2.1.4",
78
78
  "canvas": "^2.11.2",
79
79
  "cssnano": "^6.0.1",
80
80
  "d3": "^7.8.5",
81
81
  "d3-queue": "^3.0.7",
82
- "devtools-protocol": "^0.0.1170846",
82
+ "devtools-protocol": "^0.0.1173815",
83
83
  "diff": "^5.1.0",
84
84
  "dts-bundle-generator": "^8.0.1",
85
- "eslint": "^8.45.0",
85
+ "eslint": "^8.46.0",
86
86
  "eslint-config-mourner": "^3.0.0",
87
87
  "eslint-plugin-html": "^7.1.0",
88
- "eslint-plugin-import": "^2.27.5",
88
+ "eslint-plugin-import": "^2.28.0",
89
89
  "eslint-plugin-jest": "^27.2.3",
90
+ "eslint-plugin-react": "^7.33.1",
90
91
  "eslint-plugin-tsdoc": "0.2.17",
91
- "eslint-plugin-react": "^7.33.0",
92
- "expect": "^29.5.0",
92
+ "expect": "^29.6.2",
93
93
  "gl": "^6.0.2",
94
94
  "glob": "^10.3.3",
95
95
  "is-builtin-module": "^3.2.1",
96
- "jest": "^29.6.1",
96
+ "jest": "^29.6.2",
97
97
  "jest-canvas-mock": "^2.5.2",
98
- "jest-environment-jsdom": "^29.6.1",
98
+ "jest-environment-jsdom": "^29.6.2",
99
99
  "jsdom": "^22.1.0",
100
100
  "json-stringify-pretty-compact": "^4.0.0",
101
101
  "minimist": "^1.2.8",
@@ -107,14 +107,14 @@
107
107
  "pdf-merger-js": "^4.3.0",
108
108
  "pixelmatch": "^5.3.0",
109
109
  "pngjs": "^7.0.0",
110
- "postcss": "^8.4.26",
110
+ "postcss": "^8.4.27",
111
111
  "postcss-cli": "^10.1.0",
112
112
  "postcss-inline-svg": "^6.0.0",
113
113
  "pretty-bytes": "^6.1.1",
114
114
  "puppeteer": "^20.9.0",
115
115
  "react": "^18.2.0",
116
116
  "react-dom": "^18.2.0",
117
- "rollup": "^3.26.3",
117
+ "rollup": "^3.27.0",
118
118
  "rollup-plugin-sourcemaps": "^0.6.3",
119
119
  "rw": "^1.3.3",
120
120
  "semver": "^7.5.4",
@@ -125,10 +125,10 @@
125
125
  "stylelint-config-standard": "^34.0.0",
126
126
  "ts-jest": "^29.1.1",
127
127
  "ts-node": "^10.9.1",
128
- "tslib": "^2.6.0",
128
+ "tslib": "^2.6.1",
129
129
  "typedoc": "^0.24.8",
130
- "typedoc-plugin-markdown": "^3.15.3",
131
- "typedoc-plugin-missing-exports": "^2.0.0",
130
+ "typedoc-plugin-markdown": "^3.15.4",
131
+ "typedoc-plugin-missing-exports": "^2.0.1",
132
132
  "typescript": "^5.1.6"
133
133
  },
134
134
  "overrides": {
@@ -5,6 +5,7 @@ import {register} from '../util/web_worker_transfer';
5
5
  import Point from '@mapbox/point-geometry';
6
6
 
7
7
  /**
8
+ * @internal
8
9
  * Implementation of the StructArray layout:
9
10
  * [0]: Int16[2]
10
11
  *
@@ -36,6 +37,7 @@ StructArrayLayout2i4.prototype.bytesPerElement = 4;
36
37
  register('StructArrayLayout2i4', StructArrayLayout2i4);
37
38
 
38
39
  /**
40
+ * @internal
39
41
  * Implementation of the StructArray layout:
40
42
  * [0]: Int16[3]
41
43
  *
@@ -68,6 +70,7 @@ StructArrayLayout3i6.prototype.bytesPerElement = 6;
68
70
  register('StructArrayLayout3i6', StructArrayLayout3i6);
69
71
 
70
72
  /**
73
+ * @internal
71
74
  * Implementation of the StructArray layout:
72
75
  * [0]: Int16[4]
73
76
  *
@@ -101,6 +104,7 @@ StructArrayLayout4i8.prototype.bytesPerElement = 8;
101
104
  register('StructArrayLayout4i8', StructArrayLayout4i8);
102
105
 
103
106
  /**
107
+ * @internal
104
108
  * Implementation of the StructArray layout:
105
109
  * [0]: Int16[2]
106
110
  * [4]: Int16[4]
@@ -137,6 +141,7 @@ StructArrayLayout2i4i12.prototype.bytesPerElement = 12;
137
141
  register('StructArrayLayout2i4i12', StructArrayLayout2i4i12);
138
142
 
139
143
  /**
144
+ * @internal
140
145
  * Implementation of the StructArray layout:
141
146
  * [0]: Int16[2]
142
147
  * [4]: Uint8[4]
@@ -174,6 +179,7 @@ StructArrayLayout2i4ub8.prototype.bytesPerElement = 8;
174
179
  register('StructArrayLayout2i4ub8', StructArrayLayout2i4ub8);
175
180
 
176
181
  /**
182
+ * @internal
177
183
  * Implementation of the StructArray layout:
178
184
  * [0]: Float32[2]
179
185
  *
@@ -205,6 +211,7 @@ StructArrayLayout2f8.prototype.bytesPerElement = 8;
205
211
  register('StructArrayLayout2f8', StructArrayLayout2f8);
206
212
 
207
213
  /**
214
+ * @internal
208
215
  * Implementation of the StructArray layout:
209
216
  * [0]: Uint16[10]
210
217
  *
@@ -244,6 +251,7 @@ StructArrayLayout10ui20.prototype.bytesPerElement = 20;
244
251
  register('StructArrayLayout10ui20', StructArrayLayout10ui20);
245
252
 
246
253
  /**
254
+ * @internal
247
255
  * Implementation of the StructArray layout:
248
256
  * [0]: Int16[4]
249
257
  * [8]: Uint16[4]
@@ -289,6 +297,7 @@ StructArrayLayout4i4ui4i24.prototype.bytesPerElement = 24;
289
297
  register('StructArrayLayout4i4ui4i24', StructArrayLayout4i4ui4i24);
290
298
 
291
299
  /**
300
+ * @internal
292
301
  * Implementation of the StructArray layout:
293
302
  * [0]: Float32[3]
294
303
  *
@@ -321,6 +330,7 @@ StructArrayLayout3f12.prototype.bytesPerElement = 12;
321
330
  register('StructArrayLayout3f12', StructArrayLayout3f12);
322
331
 
323
332
  /**
333
+ * @internal
324
334
  * Implementation of the StructArray layout:
325
335
  * [0]: Uint32[1]
326
336
  *
@@ -351,6 +361,7 @@ StructArrayLayout1ul4.prototype.bytesPerElement = 4;
351
361
  register('StructArrayLayout1ul4', StructArrayLayout1ul4);
352
362
 
353
363
  /**
364
+ * @internal
354
365
  * Implementation of the StructArray layout:
355
366
  * [0]: Int16[6]
356
367
  * [12]: Uint32[1]
@@ -396,6 +407,7 @@ StructArrayLayout6i1ul2ui20.prototype.bytesPerElement = 20;
396
407
  register('StructArrayLayout6i1ul2ui20', StructArrayLayout6i1ul2ui20);
397
408
 
398
409
  /**
410
+ * @internal
399
411
  * Implementation of the StructArray layout:
400
412
  * [0]: Int16[2]
401
413
  * [4]: Int16[2]
@@ -433,6 +445,7 @@ StructArrayLayout2i2i2i12.prototype.bytesPerElement = 12;
433
445
  register('StructArrayLayout2i2i2i12', StructArrayLayout2i2i2i12);
434
446
 
435
447
  /**
448
+ * @internal
436
449
  * Implementation of the StructArray layout:
437
450
  * [0]: Float32[2]
438
451
  * [8]: Float32[1]
@@ -472,6 +485,7 @@ StructArrayLayout2f1f2i16.prototype.bytesPerElement = 16;
472
485
  register('StructArrayLayout2f1f2i16', StructArrayLayout2f1f2i16);
473
486
 
474
487
  /**
488
+ * @internal
475
489
  * Implementation of the StructArray layout:
476
490
  * [0]: Uint8[2]
477
491
  * [4]: Float32[2]
@@ -507,6 +521,7 @@ StructArrayLayout2ub2f12.prototype.bytesPerElement = 12;
507
521
  register('StructArrayLayout2ub2f12', StructArrayLayout2ub2f12);
508
522
 
509
523
  /**
524
+ * @internal
510
525
  * Implementation of the StructArray layout:
511
526
  * [0]: Uint16[3]
512
527
  *
@@ -539,6 +554,7 @@ StructArrayLayout3ui6.prototype.bytesPerElement = 6;
539
554
  register('StructArrayLayout3ui6', StructArrayLayout3ui6);
540
555
 
541
556
  /**
557
+ * @internal
542
558
  * Implementation of the StructArray layout:
543
559
  * [0]: Int16[2]
544
560
  * [4]: Uint16[2]
@@ -600,6 +616,7 @@ StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48.prototype.bytesPerElement = 48;
600
616
  register('StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48', StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48);
601
617
 
602
618
  /**
619
+ * @internal
603
620
  * Implementation of the StructArray layout:
604
621
  * [0]: Int16[8]
605
622
  * [16]: Uint16[15]
@@ -667,6 +684,7 @@ StructArrayLayout8i15ui1ul4f68.prototype.bytesPerElement = 68;
667
684
  register('StructArrayLayout8i15ui1ul4f68', StructArrayLayout8i15ui1ul4f68);
668
685
 
669
686
  /**
687
+ * @internal
670
688
  * Implementation of the StructArray layout:
671
689
  * [0]: Float32[1]
672
690
  *
@@ -697,6 +715,7 @@ StructArrayLayout1f4.prototype.bytesPerElement = 4;
697
715
  register('StructArrayLayout1f4', StructArrayLayout1f4);
698
716
 
699
717
  /**
718
+ * @internal
700
719
  * Implementation of the StructArray layout:
701
720
  * [0]: Uint32[1]
702
721
  * [4]: Uint16[2]
@@ -733,6 +752,7 @@ StructArrayLayout1ul2ui8.prototype.bytesPerElement = 8;
733
752
  register('StructArrayLayout1ul2ui8', StructArrayLayout1ul2ui8);
734
753
 
735
754
  /**
755
+ * @internal
736
756
  * Implementation of the StructArray layout:
737
757
  * [0]: Uint16[2]
738
758
  *
@@ -764,6 +784,7 @@ StructArrayLayout2ui4.prototype.bytesPerElement = 4;
764
784
  register('StructArrayLayout2ui4', StructArrayLayout2ui4);
765
785
 
766
786
  /**
787
+ * @internal
767
788
  * Implementation of the StructArray layout:
768
789
  * [0]: Uint16[1]
769
790
  *
@@ -794,6 +815,7 @@ StructArrayLayout1ui2.prototype.bytesPerElement = 2;
794
815
  register('StructArrayLayout1ui2', StructArrayLayout1ui2);
795
816
 
796
817
  /**
818
+ * @internal
797
819
  * Implementation of the StructArray layout:
798
820
  * [0]: Float32[4]
799
821
  *
@@ -826,7 +848,7 @@ class StructArrayLayout4f16 extends StructArray {
826
848
  StructArrayLayout4f16.prototype.bytesPerElement = 16;
827
849
  register('StructArrayLayout4f16', StructArrayLayout4f16);
828
850
 
829
- /** */
851
+ /** @internal */
830
852
  class CollisionBoxStruct extends Struct {
831
853
  _structArray: CollisionBoxArray;
832
854
  get anchorPointX() { return this._structArray.int16[this._pos2 + 0]; }
@@ -845,7 +867,7 @@ CollisionBoxStruct.prototype.size = 20;
845
867
 
846
868
  export type CollisionBox = CollisionBoxStruct;
847
869
 
848
- /** */
870
+ /** @internal */
849
871
  export class CollisionBoxArray extends StructArrayLayout6i1ul2ui20 {
850
872
  /**
851
873
  * Return the CollisionBoxStruct at the given location in the array.
@@ -858,7 +880,7 @@ export class CollisionBoxArray extends StructArrayLayout6i1ul2ui20 {
858
880
 
859
881
  register('CollisionBoxArray', CollisionBoxArray);
860
882
 
861
- /** */
883
+ /** @internal */
862
884
  class PlacedSymbolStruct extends Struct {
863
885
  _structArray: PlacedSymbolArray;
864
886
  get anchorX() { return this._structArray.int16[this._pos2 + 0]; }
@@ -887,7 +909,7 @@ PlacedSymbolStruct.prototype.size = 48;
887
909
 
888
910
  export type PlacedSymbol = PlacedSymbolStruct;
889
911
 
890
- /** */
912
+ /** @internal */
891
913
  export class PlacedSymbolArray extends StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48 {
892
914
  /**
893
915
  * Return the PlacedSymbolStruct at the given location in the array.
@@ -900,7 +922,7 @@ export class PlacedSymbolArray extends StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48
900
922
 
901
923
  register('PlacedSymbolArray', PlacedSymbolArray);
902
924
 
903
- /** */
925
+ /** @internal */
904
926
  class SymbolInstanceStruct extends Struct {
905
927
  _structArray: SymbolInstanceArray;
906
928
  get anchorX() { return this._structArray.int16[this._pos2 + 0]; }
@@ -938,7 +960,7 @@ SymbolInstanceStruct.prototype.size = 68;
938
960
 
939
961
  export type SymbolInstance = SymbolInstanceStruct;
940
962
 
941
- /** */
963
+ /** @internal */
942
964
  export class SymbolInstanceArray extends StructArrayLayout8i15ui1ul4f68 {
943
965
  /**
944
966
  * Return the SymbolInstanceStruct at the given location in the array.
@@ -951,14 +973,14 @@ export class SymbolInstanceArray extends StructArrayLayout8i15ui1ul4f68 {
951
973
 
952
974
  register('SymbolInstanceArray', SymbolInstanceArray);
953
975
 
954
- /** */
976
+ /** @internal */
955
977
  export class GlyphOffsetArray extends StructArrayLayout1f4 {
956
978
  getoffsetX(index: number) { return this.float32[index * 1 + 0]; }
957
979
  }
958
980
 
959
981
  register('GlyphOffsetArray', GlyphOffsetArray);
960
982
 
961
- /** */
983
+ /** @internal */
962
984
  export class SymbolLineVertexArray extends StructArrayLayout3i6 {
963
985
  getx(index: number) { return this.int16[index * 3 + 0]; }
964
986
  gety(index: number) { return this.int16[index * 3 + 1]; }
@@ -967,7 +989,7 @@ export class SymbolLineVertexArray extends StructArrayLayout3i6 {
967
989
 
968
990
  register('SymbolLineVertexArray', SymbolLineVertexArray);
969
991
 
970
- /** */
992
+ /** @internal */
971
993
  class FeatureIndexStruct extends Struct {
972
994
  _structArray: FeatureIndexArray;
973
995
  get featureIndex() { return this._structArray.uint32[this._pos4 + 0]; }
@@ -979,7 +1001,7 @@ FeatureIndexStruct.prototype.size = 8;
979
1001
 
980
1002
  export type FeatureIndex = FeatureIndexStruct;
981
1003
 
982
- /** */
1004
+ /** @internal */
983
1005
  export class FeatureIndexArray extends StructArrayLayout1ul2ui8 {
984
1006
  /**
985
1007
  * Return the FeatureIndexStruct at the given location in the array.
@@ -35,6 +35,7 @@ function addCircleVertex(layoutVertexArray, x, y, extrudeX, extrudeY) {
35
35
  }
36
36
 
37
37
  /**
38
+ * @internal
38
39
  * Circles are represented by two triangles.
39
40
  *
40
41
  * Each corner has a pos that is the center of the circle and an extrusion
@@ -82,6 +82,7 @@ type GradientTexture = {
82
82
  };
83
83
 
84
84
  /**
85
+ * @internal
85
86
  * Line bucket class
86
87
  */
87
88
  export class LineBucket implements Bucket {
@@ -276,6 +276,7 @@ class CollisionBuffers {
276
276
  register('CollisionBuffers', CollisionBuffers);
277
277
 
278
278
  /**
279
+ * @internal
279
280
  * Unlike other buckets, which simply implement #addFeature with type-specific
280
281
  * logic for (essentially) triangulating feature geometries, SymbolBucket
281
282
  * requires specialized behavior:
@@ -40,6 +40,7 @@ type QueryParameters = {
40
40
  };
41
41
 
42
42
  /**
43
+ * @internal
43
44
  * An in memory index class to allow fast interaction with features
44
45
  */
45
46
  export class FeatureIndex {
@@ -393,6 +393,7 @@ class CrossFadedCompositeBinder implements AttributeBinder {
393
393
  }
394
394
 
395
395
  /**
396
+ * @internal
396
397
  * ProgramConfiguration contains the logic for binding style layer properties and tile
397
398
  * layer feature data into GL program uniforms and vertex attributes.
398
399
  *
@@ -6,6 +6,7 @@ import type {VertexArrayObject} from '../render/vertex_array_object';
6
6
  import type {StructArray} from '../util/struct_array';
7
7
 
8
8
  /**
9
+ * @internal
9
10
  * A single segment of a vector
10
11
  */
11
12
  export type Segment = {
@@ -18,6 +19,7 @@ export type Segment = {
18
19
  };
19
20
 
20
21
  /**
22
+ * @internal
21
23
  * Used for calculations on vector segments
22
24
  */
23
25
  export class SegmentVector {
@@ -14,6 +14,7 @@ import type {PaddingOptions} from './edge_insets';
14
14
  import {Terrain} from '../render/terrain';
15
15
 
16
16
  /**
17
+ * @internal
17
18
  * A single transform, generally used for a single tile to be
18
19
  * scaled, rotated, and zoomed.
19
20
  */
package/src/gl/context.ts CHANGED
@@ -24,6 +24,7 @@ type ClearArgs = {
24
24
  };
25
25
 
26
26
  /**
27
+ * @internal
27
28
  * A webgl wrapper class to allow injection, mocking and abstaction
28
29
  */
29
30
  export class Context {
@@ -3,6 +3,7 @@ import {ColorAttachment, DepthAttachment, DepthStencilAttachment} from './value'
3
3
  import type {Context} from './context';
4
4
 
5
5
  /**
6
+ * @internal
6
7
  * A framebuffer holder object
7
8
  */
8
9
  export class Framebuffer {
@@ -4,6 +4,7 @@ import type {TriangleIndexArray, LineIndexArray, LineStripIndexArray} from '../d
4
4
  import type {Context} from '../gl/context';
5
5
 
6
6
  /**
7
+ * @internal
7
8
  * an index buffer class
8
9
  */
9
10
  export class IndexBuffer {
@@ -10,7 +10,8 @@ export type PoolObject = {
10
10
  inUse: boolean;
11
11
  };
12
12
  /**
13
- * RenderPool a resource pool for textures and framebuffers
13
+ * @internal
14
+ * `RenderPool` is a resource pool for textures and framebuffers
14
15
  */
15
16
  export class RenderPool {
16
17
  private _objects: Array<PoolObject>;
@@ -21,6 +21,7 @@ const AttributeType = {
21
21
  };
22
22
 
23
23
  /**
24
+ * @internal
24
25
  * The `VertexBuffer` class turns a `StructArray` into a WebGL buffer. Each member of the StructArray's
25
26
  * Struct type is converted to a WebGL attribute.
26
27
  */
@@ -61,6 +61,7 @@ export class ImagePosition {
61
61
  }
62
62
 
63
63
  /**
64
+ * @internal
64
65
  * A class holding all the images
65
66
  */
66
67
  export class ImageAtlas {
@@ -12,6 +12,7 @@ type DashEntry = {
12
12
  }
13
13
 
14
14
  /**
15
+ * @internal
15
16
  * A LineAtlas lets us reuse rendered dashed lines
16
17
  * by writing many of them to a texture and then fetching their positions
17
18
  * using {@link LineAtlas#getDash}.
@@ -61,6 +61,7 @@ type PainterOptions = {
61
61
  };
62
62
 
63
63
  /**
64
+ * @internal
64
65
  * Initialize a new painter object.
65
66
  */
66
67
  export class Painter {
@@ -30,6 +30,7 @@ function getTokenizedAttributesAndUniforms(array: Array<string>): Array<string>
30
30
  }
31
31
 
32
32
  /**
33
+ * @internal
33
34
  * A webgl program to execute in the GPU space
34
35
  */
35
36
  export class Program<Us extends UniformBindings> {
@@ -9,7 +9,9 @@ import {RenderPool} from '../gl/render_pool';
9
9
  import {Texture} from './texture';
10
10
  import type {StyleLayer} from '../style/style_layer';
11
11
 
12
- // lookup table which layers should rendered to texture
12
+ /**
13
+ * lookup table which layers should rendered to texture
14
+ */
13
15
  const LAYERS: { [keyof in StyleLayer['type']]?: boolean } = {
14
16
  background: true,
15
17
  fill: true,
@@ -19,30 +21,45 @@ const LAYERS: { [keyof in StyleLayer['type']]?: boolean } = {
19
21
  };
20
22
 
21
23
  /**
22
- * RenderToTexture
24
+ * @internal
25
+ * A helper class to help define what should be rendered to texture and how
23
26
  */
24
27
  export class RenderToTexture {
25
28
  painter: Painter;
26
29
  terrain: Terrain;
27
30
  pool: RenderPool;
28
- // coordsDescendingInv contains a list of all tiles which should be rendered for one render-to-texture tile
29
- // e.g. render 4 raster-tiles with size 256px to the 512px render-to-texture tile
31
+ /**
32
+ * coordsDescendingInv contains a list of all tiles which should be rendered for one render-to-texture tile
33
+ * e.g. render 4 raster-tiles with size 256px to the 512px render-to-texture tile
34
+ */
30
35
  _coordsDescendingInv: {[_: string]: {[_:string]: Array<OverscaledTileID>}};
31
- // create a string representation of all to tiles rendered to render-to-texture tiles
32
- // this string representation is used to check if tile should be re-rendered.
36
+ /**
37
+ * create a string representation of all to tiles rendered to render-to-texture tiles
38
+ * this string representation is used to check if tile should be re-rendered.
39
+ */
33
40
  _coordsDescendingInvStr: {[_: string]: {[_:string]: string}};
34
- // store for render-stacks
35
- // a render stack is a set of layers which should be rendered into one texture
36
- // every stylesheet can have multiple stacks. A new stack is created if layers which should
37
- // not rendered to texture sit inbetween layers which should rendered to texture. e.g. hillshading or symbols
41
+ /**
42
+ * store for render-stacks
43
+ * a render stack is a set of layers which should be rendered into one texture
44
+ * every stylesheet can have multiple stacks. A new stack is created if layers which should
45
+ * not rendered to texture sit inbetween layers which should rendered to texture. e.g. hillshading or symbols
46
+ */
38
47
  _stacks: Array<Array<string>>;
39
- // remember the previous processed layer to check if a new stack is needed
48
+ /**
49
+ * remember the previous processed layer to check if a new stack is needed
50
+ */
40
51
  _prevType: string;
41
- // a list of tiles that can potentially rendered
52
+ /**
53
+ * a list of tiles that can potentially rendered
54
+ */
42
55
  _renderableTiles: Array<Tile>;
43
- // a list of tiles that should be rendered to screen in the next render-call
56
+ /**
57
+ * a list of tiles that should be rendered to screen in the next render-call
58
+ */
44
59
  _rttTiles: Array<Tile>;
45
- // a list of all layer-ids which should be rendered
60
+ /**
61
+ * a list of all layer-ids which should be rendered
62
+ */
46
63
  _renderableLayerIds: Array<string>;
47
64
 
48
65
  constructor(painter: Painter, terrain: Terrain) {
@@ -21,6 +21,7 @@ import type {TerrainSpecification} from '@maplibre/maplibre-gl-style-spec';
21
21
  import {LngLat, earthRadius} from '../geo/lng_lat';
22
22
 
23
23
  /**
24
+ * @internal
24
25
  * A terrain GPU related object
25
26
  */
26
27
  export type TerrainData = {
@@ -36,6 +37,7 @@ export type TerrainData = {
36
37
  }
37
38
 
38
39
  /**
40
+ * @internal
39
41
  * A terrain mesh object
40
42
  */
41
43
  export type TerrainMesh = {
@@ -45,6 +47,7 @@ export type TerrainMesh = {
45
47
  }
46
48
 
47
49
  /**
50
+ * @internal
48
51
  * This is the main class which handles most of the 3D Terrain logic. It has the following topics:
49
52
  * 1) loads raster-dem tiles via the internal sourceCache this.sourceCache
50
53
  * 2) creates a depth-framebuffer, which is used to calculate the visibility of coordinates
@@ -16,6 +16,7 @@ type DataTextureImage = RGBAImage | AlphaImage | EmptyImage;
16
16
  export type TextureImage = TexImageSource | DataTextureImage;
17
17
 
18
18
  /**
19
+ * @internal
19
20
  * A `Texture` GL related object
20
21
  */
21
22
  export class Texture {
@@ -11,6 +11,7 @@ export type UniformValues<Us extends {}> = $ObjMap<Us, <V>(u: Uniform<V>) => V>;
11
11
  export type UniformLocations = {[_: string]: WebGLUniformLocation};
12
12
 
13
13
  /**
14
+ * @internal
14
15
  * A base uniform abstract class
15
16
  */
16
17
  abstract class Uniform<T> {
@@ -150,6 +151,7 @@ export {
150
151
  };
151
152
 
152
153
  /**
154
+ * @internal
153
155
  * A uniform bindings
154
156
  */
155
157
  export type UniformBindings = {[_: string]: Uniform<any>};
@@ -5,6 +5,7 @@ import type {IndexBuffer} from '../gl/index_buffer';
5
5
  import type {Context} from '../gl/context';
6
6
 
7
7
  /**
8
+ * @internal
8
9
  * A vertex array object used to pass data to the webgl code
9
10
  */
10
11
  export class VertexArrayObject {
@@ -33,16 +33,22 @@ void main() {
33
33
 
34
34
  lowp vec4 color = fill_color;
35
35
  highp float gamma = EDGE_GAMMA / (fontScale * u_gamma_scale);
36
- lowp float buff = (256.0 - 64.0) / 256.0;
36
+ lowp float inner_edge = (256.0 - 64.0) / 256.0;
37
37
  if (u_is_halo) {
38
38
  color = halo_color;
39
39
  gamma = (halo_blur * 1.19 / SDF_PX + EDGE_GAMMA) / (fontScale * u_gamma_scale);
40
- buff = (6.0 - halo_width / fontScale) / SDF_PX;
40
+ inner_edge = inner_edge + gamma * gamma_scale;
41
41
  }
42
42
 
43
43
  lowp float dist = texture(u_texture, tex).a;
44
44
  highp float gamma_scaled = gamma * gamma_scale;
45
- highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist);
45
+ highp float alpha = smoothstep(inner_edge - gamma_scaled, inner_edge + gamma_scaled, dist);
46
+ if (u_is_halo) {
47
+ // When drawing halos, we want the inside of the halo to be transparent as well
48
+ // in case the text fill is transparent.
49
+ lowp float halo_edge = (6.0 - halo_width / fontScale) / SDF_PX;
50
+ alpha = min(smoothstep(halo_edge - gamma_scaled, halo_edge + gamma_scaled, dist), 1.0 - alpha);
51
+ }
46
52
 
47
53
  fragColor = color * (alpha * opacity * fade_opacity);
48
54