maplibre-gl 3.2.1 → 3.3.0

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 (88) hide show
  1. package/build/generate-struct-arrays.ts +6 -3
  2. package/build/generate-style-code.ts +7 -8
  3. package/dist/maplibre-gl-csp-worker.js +1 -1
  4. package/dist/maplibre-gl-csp-worker.js.map +1 -1
  5. package/dist/maplibre-gl-csp.js +1 -1
  6. package/dist/maplibre-gl-csp.js.map +1 -1
  7. package/dist/maplibre-gl-dev.js +565 -243
  8. package/dist/maplibre-gl-dev.js.map +1 -1
  9. package/dist/maplibre-gl.d.ts +111 -57
  10. package/dist/maplibre-gl.js +4 -4
  11. package/dist/maplibre-gl.js.map +1 -1
  12. package/package.json +20 -20
  13. package/src/data/array_types.g.ts +110 -24
  14. package/src/data/bucket/circle_bucket.ts +1 -0
  15. package/src/data/bucket/line_bucket.ts +1 -0
  16. package/src/data/bucket/symbol_attributes.ts +7 -1
  17. package/src/data/bucket/symbol_bucket.ts +5 -1
  18. package/src/data/feature_index.ts +1 -0
  19. package/src/data/program_configuration.ts +1 -0
  20. package/src/data/segment.ts +2 -0
  21. package/src/geo/transform.ts +1 -0
  22. package/src/gl/context.ts +1 -0
  23. package/src/gl/framebuffer.ts +1 -0
  24. package/src/gl/index_buffer.ts +1 -0
  25. package/src/gl/render_pool.ts +2 -1
  26. package/src/gl/vertex_buffer.ts +1 -0
  27. package/src/render/draw_symbol.ts +8 -9
  28. package/src/render/image_atlas.ts +1 -0
  29. package/src/render/line_atlas.ts +1 -0
  30. package/src/render/painter.ts +1 -0
  31. package/src/render/program.ts +1 -0
  32. package/src/render/render_to_texture.ts +31 -14
  33. package/src/render/terrain.ts +3 -0
  34. package/src/render/texture.ts +1 -0
  35. package/src/render/uniform_binding.ts +2 -0
  36. package/src/render/vertex_array_object.ts +1 -0
  37. package/src/shaders/symbol_sdf.fragment.glsl +9 -3
  38. package/src/shaders/symbol_sdf.fragment.glsl.g.ts +1 -1
  39. package/src/source/canvas_source.ts +1 -3
  40. package/src/source/geojson_source.ts +1 -3
  41. package/src/source/image_source.ts +2 -4
  42. package/src/source/source_cache.ts +1 -0
  43. package/src/source/source_state.ts +1 -0
  44. package/src/source/terrain_source_cache.ts +1 -0
  45. package/src/source/tile.ts +1 -0
  46. package/src/source/tile_cache.ts +1 -1
  47. package/src/source/tile_id.ts +1 -0
  48. package/src/source/vector_tile_worker_source.test.ts +79 -0
  49. package/src/source/vector_tile_worker_source.ts +26 -1
  50. package/src/source/worker_source.ts +1 -0
  51. package/src/style/evaluation_parameters.ts +1 -0
  52. package/src/style/properties.ts +18 -0
  53. package/src/style/style.ts +1 -0
  54. package/src/style/style_glyph.ts +1 -0
  55. package/src/style/style_layer/background_style_layer_properties.g.ts +1 -6
  56. package/src/style/style_layer/circle_style_layer_properties.g.ts +1 -6
  57. package/src/style/style_layer/fill_extrusion_style_layer_properties.g.ts +1 -6
  58. package/src/style/style_layer/fill_style_layer_properties.g.ts +1 -6
  59. package/src/style/style_layer/heatmap_style_layer_properties.g.ts +1 -6
  60. package/src/style/style_layer/hillshade_style_layer_properties.g.ts +1 -6
  61. package/src/style/style_layer/line_style_layer_properties.g.ts +1 -6
  62. package/src/style/style_layer/raster_style_layer_properties.g.ts +1 -6
  63. package/src/style/style_layer/symbol_style_layer_properties.g.ts +4 -6
  64. package/src/style/style_layer/variable_text_anchor.test.ts +117 -0
  65. package/src/style/style_layer/variable_text_anchor.ts +163 -0
  66. package/src/symbol/collision_index.ts +1 -0
  67. package/src/symbol/grid_index.ts +1 -0
  68. package/src/symbol/placement.ts +52 -40
  69. package/src/symbol/symbol_layout.ts +42 -116
  70. package/src/ui/camera.ts +8 -8
  71. package/src/ui/handler/box_zoom.ts +1 -3
  72. package/src/ui/handler/click_zoom.ts +1 -3
  73. package/src/ui/handler/keyboard.ts +1 -3
  74. package/src/ui/handler/scroll_zoom.ts +1 -3
  75. package/src/ui/handler/shim/dblclick_zoom.ts +1 -3
  76. package/src/ui/handler/shim/drag_pan.ts +1 -3
  77. package/src/ui/handler/shim/drag_rotate.ts +1 -3
  78. package/src/ui/handler/shim/two_fingers_touch.ts +1 -3
  79. package/src/ui/handler/transform-provider.ts +1 -0
  80. package/src/ui/handler/two_fingers_touch.ts +1 -3
  81. package/src/ui/map.ts +7 -6
  82. package/src/util/ajax.test.ts +33 -0
  83. package/src/util/ajax.ts +5 -0
  84. package/src/util/image.ts +1 -0
  85. package/src/util/image_request.ts +2 -2
  86. package/src/util/performance.ts +1 -2
  87. package/src/util/struct_array.ts +5 -1
  88. 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.3.0",
5
5
  "main": "dist/maplibre-gl.js",
6
6
  "style": "dist/maplibre-gl.css",
7
7
  "license": "BSD-3-Clause",
@@ -20,7 +20,7 @@
20
20
  "@mapbox/unitbezier": "^0.0.1",
21
21
  "@mapbox/vector-tile": "^1.3.1",
22
22
  "@mapbox/whoots-js": "^3.1.0",
23
- "@maplibre/maplibre-gl-style-spec": "^19.2.2",
23
+ "@maplibre/maplibre-gl-style-spec": "^19.3.0",
24
24
  "@types/geojson": "^7946.0.10",
25
25
  "@types/mapbox__point-geometry": "^0.1.2",
26
26
  "@types/mapbox__vector-tile": "^1.3.0",
@@ -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.2",
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.8",
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.18",
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.1",
75
+ "@typescript-eslint/parser": "^6.2.1",
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.1179426",
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
- "puppeteer": "^20.9.0",
114
+ "puppeteer": "^21.0.1",
115
115
  "react": "^18.2.0",
116
116
  "react-dom": "^18.2.0",
117
- "rollup": "^3.26.3",
117
+ "rollup": "^3.27.2",
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,14 +616,16 @@ 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]
606
623
  * [48]: Uint32[1]
607
- * [52]: Float32[4]
624
+ * [52]: Float32[2]
625
+ * [60]: Uint16[2]
608
626
  *
609
627
  */
610
- class StructArrayLayout8i15ui1ul4f68 extends StructArray {
628
+ class StructArrayLayout8i15ui1ul2f2ui64 extends StructArray {
611
629
  uint8: Uint8Array;
612
630
  int16: Int16Array;
613
631
  uint16: Uint16Array;
@@ -629,8 +647,8 @@ class StructArrayLayout8i15ui1ul4f68 extends StructArray {
629
647
  }
630
648
 
631
649
  public emplace(i: number, v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, v8: number, v9: number, v10: number, v11: number, v12: number, v13: number, v14: number, v15: number, v16: number, v17: number, v18: number, v19: number, v20: number, v21: number, v22: number, v23: number, v24: number, v25: number, v26: number, v27: number) {
632
- const o2 = i * 34;
633
- const o4 = i * 17;
650
+ const o2 = i * 32;
651
+ const o4 = i * 16;
634
652
  this.int16[o2 + 0] = v0;
635
653
  this.int16[o2 + 1] = v1;
636
654
  this.int16[o2 + 2] = v2;
@@ -657,16 +675,17 @@ class StructArrayLayout8i15ui1ul4f68 extends StructArray {
657
675
  this.uint32[o4 + 12] = v23;
658
676
  this.float32[o4 + 13] = v24;
659
677
  this.float32[o4 + 14] = v25;
660
- this.float32[o4 + 15] = v26;
661
- this.float32[o4 + 16] = v27;
678
+ this.uint16[o2 + 30] = v26;
679
+ this.uint16[o2 + 31] = v27;
662
680
  return i;
663
681
  }
664
682
  }
665
683
 
666
- StructArrayLayout8i15ui1ul4f68.prototype.bytesPerElement = 68;
667
- register('StructArrayLayout8i15ui1ul4f68', StructArrayLayout8i15ui1ul4f68);
684
+ StructArrayLayout8i15ui1ul2f2ui64.prototype.bytesPerElement = 64;
685
+ register('StructArrayLayout8i15ui1ul2f2ui64', StructArrayLayout8i15ui1ul2f2ui64);
668
686
 
669
687
  /**
688
+ * @internal
670
689
  * Implementation of the StructArray layout:
671
690
  * [0]: Float32[1]
672
691
  *
@@ -697,6 +716,44 @@ StructArrayLayout1f4.prototype.bytesPerElement = 4;
697
716
  register('StructArrayLayout1f4', StructArrayLayout1f4);
698
717
 
699
718
  /**
719
+ * @internal
720
+ * Implementation of the StructArray layout:
721
+ * [0]: Uint16[1]
722
+ * [4]: Float32[2]
723
+ *
724
+ */
725
+ class StructArrayLayout1ui2f12 extends StructArray {
726
+ uint8: Uint8Array;
727
+ uint16: Uint16Array;
728
+ float32: Float32Array;
729
+
730
+ _refreshViews() {
731
+ this.uint8 = new Uint8Array(this.arrayBuffer);
732
+ this.uint16 = new Uint16Array(this.arrayBuffer);
733
+ this.float32 = new Float32Array(this.arrayBuffer);
734
+ }
735
+
736
+ public emplaceBack(v0: number, v1: number, v2: number) {
737
+ const i = this.length;
738
+ this.resize(i + 1);
739
+ return this.emplace(i, v0, v1, v2);
740
+ }
741
+
742
+ public emplace(i: number, v0: number, v1: number, v2: number) {
743
+ const o2 = i * 6;
744
+ const o4 = i * 3;
745
+ this.uint16[o2 + 0] = v0;
746
+ this.float32[o4 + 1] = v1;
747
+ this.float32[o4 + 2] = v2;
748
+ return i;
749
+ }
750
+ }
751
+
752
+ StructArrayLayout1ui2f12.prototype.bytesPerElement = 12;
753
+ register('StructArrayLayout1ui2f12', StructArrayLayout1ui2f12);
754
+
755
+ /**
756
+ * @internal
700
757
  * Implementation of the StructArray layout:
701
758
  * [0]: Uint32[1]
702
759
  * [4]: Uint16[2]
@@ -733,6 +790,7 @@ StructArrayLayout1ul2ui8.prototype.bytesPerElement = 8;
733
790
  register('StructArrayLayout1ul2ui8', StructArrayLayout1ul2ui8);
734
791
 
735
792
  /**
793
+ * @internal
736
794
  * Implementation of the StructArray layout:
737
795
  * [0]: Uint16[2]
738
796
  *
@@ -764,6 +822,7 @@ StructArrayLayout2ui4.prototype.bytesPerElement = 4;
764
822
  register('StructArrayLayout2ui4', StructArrayLayout2ui4);
765
823
 
766
824
  /**
825
+ * @internal
767
826
  * Implementation of the StructArray layout:
768
827
  * [0]: Uint16[1]
769
828
  *
@@ -794,6 +853,7 @@ StructArrayLayout1ui2.prototype.bytesPerElement = 2;
794
853
  register('StructArrayLayout1ui2', StructArrayLayout1ui2);
795
854
 
796
855
  /**
856
+ * @internal
797
857
  * Implementation of the StructArray layout:
798
858
  * [0]: Float32[4]
799
859
  *
@@ -826,7 +886,7 @@ class StructArrayLayout4f16 extends StructArray {
826
886
  StructArrayLayout4f16.prototype.bytesPerElement = 16;
827
887
  register('StructArrayLayout4f16', StructArrayLayout4f16);
828
888
 
829
- /** */
889
+ /** @internal */
830
890
  class CollisionBoxStruct extends Struct {
831
891
  _structArray: CollisionBoxArray;
832
892
  get anchorPointX() { return this._structArray.int16[this._pos2 + 0]; }
@@ -845,7 +905,7 @@ CollisionBoxStruct.prototype.size = 20;
845
905
 
846
906
  export type CollisionBox = CollisionBoxStruct;
847
907
 
848
- /** */
908
+ /** @internal */
849
909
  export class CollisionBoxArray extends StructArrayLayout6i1ul2ui20 {
850
910
  /**
851
911
  * Return the CollisionBoxStruct at the given location in the array.
@@ -858,7 +918,7 @@ export class CollisionBoxArray extends StructArrayLayout6i1ul2ui20 {
858
918
 
859
919
  register('CollisionBoxArray', CollisionBoxArray);
860
920
 
861
- /** */
921
+ /** @internal */
862
922
  class PlacedSymbolStruct extends Struct {
863
923
  _structArray: PlacedSymbolArray;
864
924
  get anchorX() { return this._structArray.int16[this._pos2 + 0]; }
@@ -887,7 +947,7 @@ PlacedSymbolStruct.prototype.size = 48;
887
947
 
888
948
  export type PlacedSymbol = PlacedSymbolStruct;
889
949
 
890
- /** */
950
+ /** @internal */
891
951
  export class PlacedSymbolArray extends StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48 {
892
952
  /**
893
953
  * Return the PlacedSymbolStruct at the given location in the array.
@@ -900,7 +960,7 @@ export class PlacedSymbolArray extends StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48
900
960
 
901
961
  register('PlacedSymbolArray', PlacedSymbolArray);
902
962
 
903
- /** */
963
+ /** @internal */
904
964
  class SymbolInstanceStruct extends Struct {
905
965
  _structArray: SymbolInstanceArray;
906
966
  get anchorX() { return this._structArray.int16[this._pos2 + 0]; }
@@ -929,17 +989,17 @@ class SymbolInstanceStruct extends Struct {
929
989
  get crossTileID() { return this._structArray.uint32[this._pos4 + 12]; }
930
990
  set crossTileID(x: number) { this._structArray.uint32[this._pos4 + 12] = x; }
931
991
  get textBoxScale() { return this._structArray.float32[this._pos4 + 13]; }
932
- get textOffset0() { return this._structArray.float32[this._pos4 + 14]; }
933
- get textOffset1() { return this._structArray.float32[this._pos4 + 15]; }
934
- get collisionCircleDiameter() { return this._structArray.float32[this._pos4 + 16]; }
992
+ get collisionCircleDiameter() { return this._structArray.float32[this._pos4 + 14]; }
993
+ get textAnchorOffsetStartIndex() { return this._structArray.uint16[this._pos2 + 30]; }
994
+ get textAnchorOffsetEndIndex() { return this._structArray.uint16[this._pos2 + 31]; }
935
995
  }
936
996
 
937
- SymbolInstanceStruct.prototype.size = 68;
997
+ SymbolInstanceStruct.prototype.size = 64;
938
998
 
939
999
  export type SymbolInstance = SymbolInstanceStruct;
940
1000
 
941
- /** */
942
- export class SymbolInstanceArray extends StructArrayLayout8i15ui1ul4f68 {
1001
+ /** @internal */
1002
+ export class SymbolInstanceArray extends StructArrayLayout8i15ui1ul2f2ui64 {
943
1003
  /**
944
1004
  * Return the SymbolInstanceStruct at the given location in the array.
945
1005
  * @param index The index of the element.
@@ -951,14 +1011,14 @@ export class SymbolInstanceArray extends StructArrayLayout8i15ui1ul4f68 {
951
1011
 
952
1012
  register('SymbolInstanceArray', SymbolInstanceArray);
953
1013
 
954
- /** */
1014
+ /** @internal */
955
1015
  export class GlyphOffsetArray extends StructArrayLayout1f4 {
956
1016
  getoffsetX(index: number) { return this.float32[index * 1 + 0]; }
957
1017
  }
958
1018
 
959
1019
  register('GlyphOffsetArray', GlyphOffsetArray);
960
1020
 
961
- /** */
1021
+ /** @internal */
962
1022
  export class SymbolLineVertexArray extends StructArrayLayout3i6 {
963
1023
  getx(index: number) { return this.int16[index * 3 + 0]; }
964
1024
  gety(index: number) { return this.int16[index * 3 + 1]; }
@@ -967,7 +1027,32 @@ export class SymbolLineVertexArray extends StructArrayLayout3i6 {
967
1027
 
968
1028
  register('SymbolLineVertexArray', SymbolLineVertexArray);
969
1029
 
970
- /** */
1030
+ /** @internal */
1031
+ class TextAnchorOffsetStruct extends Struct {
1032
+ _structArray: TextAnchorOffsetArray;
1033
+ get textAnchor() { return this._structArray.uint16[this._pos2 + 0]; }
1034
+ get textOffset0() { return this._structArray.float32[this._pos4 + 1]; }
1035
+ get textOffset1() { return this._structArray.float32[this._pos4 + 2]; }
1036
+ }
1037
+
1038
+ TextAnchorOffsetStruct.prototype.size = 12;
1039
+
1040
+ export type TextAnchorOffset = TextAnchorOffsetStruct;
1041
+
1042
+ /** @internal */
1043
+ export class TextAnchorOffsetArray extends StructArrayLayout1ui2f12 {
1044
+ /**
1045
+ * Return the TextAnchorOffsetStruct at the given location in the array.
1046
+ * @param index The index of the element.
1047
+ */
1048
+ get(index: number): TextAnchorOffsetStruct {
1049
+ return new TextAnchorOffsetStruct(this, index);
1050
+ }
1051
+ }
1052
+
1053
+ register('TextAnchorOffsetArray', TextAnchorOffsetArray);
1054
+
1055
+ /** @internal */
971
1056
  class FeatureIndexStruct extends Struct {
972
1057
  _structArray: FeatureIndexArray;
973
1058
  get featureIndex() { return this._structArray.uint32[this._pos4 + 0]; }
@@ -979,7 +1064,7 @@ FeatureIndexStruct.prototype.size = 8;
979
1064
 
980
1065
  export type FeatureIndex = FeatureIndexStruct;
981
1066
 
982
- /** */
1067
+ /** @internal */
983
1068
  export class FeatureIndexArray extends StructArrayLayout1ul2ui8 {
984
1069
  /**
985
1070
  * Return the FeatureIndexStruct at the given location in the array.
@@ -1029,8 +1114,9 @@ export {
1029
1114
  StructArrayLayout2ub2f12,
1030
1115
  StructArrayLayout3ui6,
1031
1116
  StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48,
1032
- StructArrayLayout8i15ui1ul4f68,
1117
+ StructArrayLayout8i15ui1ul2f2ui64,
1033
1118
  StructArrayLayout1f4,
1119
+ StructArrayLayout1ui2f12,
1034
1120
  StructArrayLayout1ul2ui8,
1035
1121
  StructArrayLayout2ui4,
1036
1122
  StructArrayLayout1ui2,
@@ -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 {
@@ -100,8 +100,9 @@ export const symbolInstance = createLayout([
100
100
  {type: 'Uint16', name: 'useRuntimeCollisionCircles'},
101
101
  {type: 'Uint32', name: 'crossTileID'},
102
102
  {type: 'Float32', name: 'textBoxScale'},
103
- {type: 'Float32', components: 2, name: 'textOffset'},
104
103
  {type: 'Float32', name: 'collisionCircleDiameter'},
104
+ {type: 'Uint16', name: 'textAnchorOffsetStartIndex'},
105
+ {type: 'Uint16', name: 'textAnchorOffsetEndIndex'}
105
106
  ]);
106
107
 
107
108
  export const glyphOffset = createLayout([
@@ -113,3 +114,8 @@ export const lineVertex = createLayout([
113
114
  {type: 'Int16', name: 'y'},
114
115
  {type: 'Int16', name: 'tileUnitDistanceFromAnchor'}
115
116
  ]);
117
+
118
+ export const textAnchorOffset = createLayout([
119
+ {type: 'Uint16', name: 'textAnchor'},
120
+ {type: 'Float32', components: 2, name: 'textOffset'}
121
+ ]);
@@ -13,7 +13,8 @@ import {SymbolLayoutArray,
13
13
  PlacedSymbolArray,
14
14
  SymbolInstanceArray,
15
15
  GlyphOffsetArray,
16
- SymbolLineVertexArray
16
+ SymbolLineVertexArray,
17
+ TextAnchorOffsetArray
17
18
  } from '../array_types.g';
18
19
 
19
20
  import Point from '@mapbox/point-geometry';
@@ -276,6 +277,7 @@ class CollisionBuffers {
276
277
  register('CollisionBuffers', CollisionBuffers);
277
278
 
278
279
  /**
280
+ * @internal
279
281
  * Unlike other buckets, which simply implement #addFeature with type-specific
280
282
  * logic for (essentially) triangulating feature geometries, SymbolBucket
281
283
  * requires specialized behavior:
@@ -332,6 +334,7 @@ export class SymbolBucket implements Bucket {
332
334
  lineVertexArray: SymbolLineVertexArray;
333
335
  features: Array<SymbolFeature>;
334
336
  symbolInstances: SymbolInstanceArray;
337
+ textAnchorOffsets: TextAnchorOffsetArray;
335
338
  collisionArrays: Array<CollisionArrays>;
336
339
  sortKeyRanges: Array<SortKeyRange>;
337
340
  pixelRatio: number;
@@ -411,6 +414,7 @@ export class SymbolBucket implements Bucket {
411
414
  this.glyphOffsetArray = new GlyphOffsetArray();
412
415
  this.lineVertexArray = new SymbolLineVertexArray();
413
416
  this.symbolInstances = new SymbolInstanceArray();
417
+ this.textAnchorOffsets = new TextAnchorOffsetArray();
414
418
  }
415
419
 
416
420
  calculateGlyphDependencies(text: string, stack: {[_: number]: boolean}, textAlongLine: boolean, allowVerticalPlacement: boolean, doesAllowVerticalWritingMode: boolean) {
@@ -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
  */