maplibre-gl 6.2.0 → 6.4.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 (150) hide show
  1. package/dist/maplibre-gl-dev.mjs +1108 -427
  2. package/dist/maplibre-gl-dev.mjs.map +1 -1
  3. package/dist/maplibre-gl-shared-dev.mjs +359 -291
  4. package/dist/maplibre-gl-shared-dev.mjs.map +1 -1
  5. package/dist/maplibre-gl-shared.mjs +2 -2
  6. package/dist/maplibre-gl-shared.mjs.map +1 -1
  7. package/dist/maplibre-gl-worker-dev.mjs +23 -49
  8. package/dist/maplibre-gl-worker-dev.mjs.map +1 -1
  9. package/dist/maplibre-gl-worker.mjs +2 -2
  10. package/dist/maplibre-gl-worker.mjs.map +1 -1
  11. package/dist/maplibre-gl.css +1 -1
  12. package/dist/maplibre-gl.d.ts +467 -151
  13. package/dist/maplibre-gl.mjs +49 -49
  14. package/dist/maplibre-gl.mjs.map +1 -1
  15. package/package.json +12 -22
  16. package/src/data/bucket/fill_extrusion_bucket.ts +1 -13
  17. package/src/data/bucket/round_polygon_corners.test.ts +84 -36
  18. package/src/data/bucket/round_polygon_corners.ts +90 -39
  19. package/src/data/extent_bounds.ts +28 -1
  20. package/src/data/feature_index.bench.ts +21 -0
  21. package/src/data/segment.test.ts +2 -2
  22. package/src/geo/edge_insets.test.ts +1 -1
  23. package/src/geo/lng_lat.test.ts +7 -7
  24. package/src/geo/lng_lat_bounds.test.ts +4 -4
  25. package/src/geo/mercator_coordinate.test.ts +2 -2
  26. package/src/geo/projection/camera_helper.ts +5 -0
  27. package/src/geo/projection/globe_transform.test.ts +154 -1
  28. package/src/geo/projection/globe_transform.ts +7 -3
  29. package/src/geo/projection/globe_utils.ts +189 -2
  30. package/src/geo/projection/mercator_camera_helper.ts +1 -1
  31. package/src/geo/projection/mercator_transform.ts +21 -5
  32. package/src/geo/projection/vertical_perspective_camera_helper.test.ts +24 -0
  33. package/src/geo/projection/vertical_perspective_camera_helper.ts +71 -41
  34. package/src/geo/projection/vertical_perspective_transform.ts +7 -1
  35. package/src/geo/transform_interface.ts +13 -1
  36. package/src/index.ts +7 -2
  37. package/src/render/image_atlas.test.ts +180 -0
  38. package/src/render/image_atlas.ts +52 -6
  39. package/src/render/image_manager.test.ts +111 -0
  40. package/src/render/image_manager.ts +143 -144
  41. package/src/render/painter.ts +6 -14
  42. package/src/render/pattern_atlas.test.ts +131 -0
  43. package/src/render/pattern_atlas.ts +144 -0
  44. package/src/render/update_pattern_positions_in_program.test.ts +1 -1
  45. package/src/shaders/glsl/_prelude.vertex.glsl +10 -11
  46. package/src/shaders/glsl/_prelude.vertex.glsl.g.ts +1 -1
  47. package/src/shaders/glsl/circle.vertex.glsl +4 -4
  48. package/src/shaders/glsl/circle.vertex.glsl.g.ts +1 -1
  49. package/src/shaders/glsl/color_relief.fragment.glsl +1 -2
  50. package/src/shaders/glsl/color_relief.fragment.glsl.g.ts +1 -1
  51. package/src/shaders/glsl/fill_extrusion.vertex.glsl +3 -3
  52. package/src/shaders/glsl/fill_extrusion.vertex.glsl.g.ts +1 -1
  53. package/src/shaders/glsl/fill_extrusion_pattern.vertex.glsl +5 -5
  54. package/src/shaders/glsl/fill_extrusion_pattern.vertex.glsl.g.ts +1 -1
  55. package/src/shaders/glsl/heatmap.vertex.glsl +4 -4
  56. package/src/shaders/glsl/heatmap.vertex.glsl.g.ts +1 -1
  57. package/src/shaders/glsl/hillshade_prepare.fragment.glsl +12 -12
  58. package/src/shaders/glsl/hillshade_prepare.fragment.glsl.g.ts +1 -1
  59. package/src/shaders/glsl/line.vertex.glsl +7 -7
  60. package/src/shaders/glsl/line.vertex.glsl.g.ts +1 -1
  61. package/src/shaders/glsl/line_gradient.vertex.glsl +6 -6
  62. package/src/shaders/glsl/line_gradient.vertex.glsl.g.ts +1 -1
  63. package/src/shaders/glsl/line_gradient_sdf.vertex.glsl +7 -7
  64. package/src/shaders/glsl/line_gradient_sdf.vertex.glsl.g.ts +1 -1
  65. package/src/shaders/glsl/line_pattern.vertex.glsl +7 -7
  66. package/src/shaders/glsl/line_pattern.vertex.glsl.g.ts +1 -1
  67. package/src/shaders/glsl/line_sdf.vertex.glsl +7 -7
  68. package/src/shaders/glsl/line_sdf.vertex.glsl.g.ts +1 -1
  69. package/src/shaders/glsl/raster.fragment.glsl +4 -4
  70. package/src/shaders/glsl/raster.fragment.glsl.g.ts +1 -1
  71. package/src/shaders/glsl/raster.vertex.glsl +11 -6
  72. package/src/shaders/glsl/raster.vertex.glsl.g.ts +1 -1
  73. package/src/shaders/glsl/symbol_icon.vertex.glsl +5 -5
  74. package/src/shaders/glsl/symbol_icon.vertex.glsl.g.ts +1 -1
  75. package/src/shaders/glsl/symbol_sdf.vertex.glsl +5 -5
  76. package/src/shaders/glsl/symbol_sdf.vertex.glsl.g.ts +1 -1
  77. package/src/shaders/glsl/symbol_text_and_icon.vertex.glsl +6 -6
  78. package/src/shaders/glsl/symbol_text_and_icon.vertex.glsl.g.ts +1 -1
  79. package/src/source/canvas_source.test.ts +31 -0
  80. package/src/source/canvas_source.ts +2 -1
  81. package/src/source/geojson_worker_source.test.ts +88 -0
  82. package/src/source/geojson_worker_source.ts +22 -39
  83. package/src/source/image_source.test.ts +246 -38
  84. package/src/source/image_source.ts +132 -19
  85. package/src/source/raster_dem_tile_source.test.ts +37 -3
  86. package/src/source/raster_dem_tile_source.ts +1 -2
  87. package/src/source/raster_dem_tile_worker_source.test.ts +1 -1
  88. package/src/source/raster_tile_source.test.ts +5 -26
  89. package/src/source/raster_tile_source.ts +4 -3
  90. package/src/source/vector_tile_worker_source.test.ts +94 -2
  91. package/src/source/vector_tile_worker_source.ts +18 -27
  92. package/src/source/video_source.test.ts +12 -8
  93. package/src/source/worker_tile.bench.ts +10 -0
  94. package/src/source/worker_tile.ts +0 -3
  95. package/src/style/create_style_layer.bench.ts +15 -0
  96. package/src/style/properties.bench.ts +81 -0
  97. package/src/style/style.test.ts +75 -10
  98. package/src/style/style.ts +37 -64
  99. package/src/style/style_image.ts +67 -9
  100. package/src/style/style_layer.bench.ts +65 -0
  101. package/src/style/style_layer.test.ts +1 -1
  102. package/src/style/style_layer.ts +2 -2
  103. package/src/style/validate_style.bench.ts +11 -0
  104. package/src/style/validate_style.test.ts +2 -2
  105. package/src/symbol/anchor.test.ts +2 -2
  106. package/src/symbol/collision_index.bench.ts +116 -0
  107. package/src/symbol/cross_tile_symbol_index.bench.ts +49 -0
  108. package/src/symbol/cross_tile_symbol_index.test.ts +31 -0
  109. package/src/symbol/cross_tile_symbol_index.ts +67 -37
  110. package/src/symbol/shaping.test.ts +2 -1
  111. package/src/symbol/symbol_layout.bench.ts +30 -0
  112. package/src/tile/tile_id.test.ts +1 -1
  113. package/src/tile/tile_manager.test.ts +69 -1
  114. package/src/tile/tile_manager.ts +16 -11
  115. package/src/ui/control/fullscreen_control.test.ts +10 -10
  116. package/src/ui/control/geolocate_control.test.ts +3 -5
  117. package/src/ui/control/globe_control.test.ts +6 -6
  118. package/src/ui/events.ts +1 -1
  119. package/src/ui/handler/scroll_zoom.test.ts +50 -0
  120. package/src/ui/handler/two_fingers_touch.test.ts +17 -6
  121. package/src/ui/handler_inertia.test.ts +91 -0
  122. package/src/ui/handler_inertia.ts +65 -14
  123. package/src/ui/handler_manager.test.ts +243 -3
  124. package/src/ui/handler_manager.ts +79 -16
  125. package/src/ui/map.ts +17 -3
  126. package/src/ui/map_tests/map_cross_window.test.ts +2 -2
  127. package/src/ui/map_tests/map_events.test.ts +3 -3
  128. package/src/ui/map_tests/map_images.test.ts +55 -0
  129. package/src/ui/map_tests/map_style.test.ts +9 -8
  130. package/src/ui/map_tests/map_webgl.test.ts +30 -0
  131. package/src/ui/marker.test.ts +177 -42
  132. package/src/ui/marker.ts +120 -10
  133. package/src/ui/popup.test.ts +14 -14
  134. package/src/util/evented.test.ts +33 -28
  135. package/src/util/evented.ts +69 -43
  136. package/src/util/image_request.ts +31 -1
  137. package/src/util/test/null_gl.ts +10 -0
  138. package/src/util/test/util.ts +2 -1
  139. package/src/util/util.test.ts +1 -1
  140. package/src/util/web_worker_transfer.test.ts +5 -5
  141. package/src/webgl/context.ts +20 -0
  142. package/src/webgl/draw/draw_background.ts +1 -1
  143. package/src/webgl/draw/draw_raster.ts +11 -6
  144. package/src/webgl/program/pattern.ts +3 -3
  145. package/src/webgl/program/raster_program.ts +11 -0
  146. package/src/webgl/program.ts +31 -16
  147. package/src/webgl/texture.test.ts +16 -1
  148. package/src/webgl/texture.ts +3 -0
  149. package/src/webgl/vertex_buffer.test.ts +17 -2
  150. package/src/webgl/vertex_buffer.ts +24 -13
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * MapLibre GL JS
3
- * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v6.2.0/LICENSE.txt
3
+ * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v6.4.0/LICENSE.txt
4
4
  */
5
5
  //#region \0rolldown/runtime.js
6
6
  var __create = Object.create;
@@ -436,6 +436,15 @@ function invert$5(out, a) {
436
436
  return out;
437
437
  }
438
438
  /**
439
+ * Calculates the determinant of a mat2
440
+ *
441
+ * @param {ReadonlyMat2} a the source matrix
442
+ * @returns {Number} determinant of a
443
+ */
444
+ function determinant$3(a) {
445
+ return a[0] * a[3] - a[2] * a[1];
446
+ }
447
+ /**
439
448
  * Rotates a mat2 by the given angle
440
449
  *
441
450
  * @param {mat2} out the receiving matrix
@@ -1434,6 +1443,23 @@ function create$3() {
1434
1443
  return out;
1435
1444
  }
1436
1445
  /**
1446
+ * Creates a new vec4 initialized with the given values
1447
+ *
1448
+ * @param {Number} x X component
1449
+ * @param {Number} y Y component
1450
+ * @param {Number} z Z component
1451
+ * @param {Number} w W component
1452
+ * @returns {vec4} a new 4D vector
1453
+ */
1454
+ function fromValues$3(x, y, z, w) {
1455
+ var out = new ARRAY_TYPE(4);
1456
+ out[0] = x;
1457
+ out[1] = y;
1458
+ out[2] = z;
1459
+ out[3] = w;
1460
+ return out;
1461
+ }
1462
+ /**
1437
1463
  * Multiplies two vec4's
1438
1464
  *
1439
1465
  * @param {vec4} out the receiving vector
@@ -1564,6 +1590,23 @@ function setAxisAngle(out, axis, rad) {
1564
1590
  return out;
1565
1591
  }
1566
1592
  /**
1593
+ * Multiplies two quat's
1594
+ *
1595
+ * @param {quat} out the receiving quaternion
1596
+ * @param {ReadonlyQuat} a the first operand
1597
+ * @param {ReadonlyQuat} b the second operand
1598
+ * @returns {quat} out
1599
+ */
1600
+ function multiply$2(out, a, b) {
1601
+ var ax = a[0], ay = a[1], az = a[2], aw = a[3];
1602
+ var bx = b[0], by = b[1], bz = b[2], bw = b[3];
1603
+ out[0] = ax * bw + aw * bx + ay * bz - az * by;
1604
+ out[1] = ay * bw + aw * by + az * bx - ax * bz;
1605
+ out[2] = az * bw + aw * bz + ax * by - ay * bx;
1606
+ out[3] = aw * bw - ax * bx - ay * by - az * bz;
1607
+ return out;
1608
+ }
1609
+ /**
1567
1610
  * Performs a spherical linear interpolation between two quat
1568
1611
  *
1569
1612
  * @param {quat} out the receiving quaternion
@@ -1699,6 +1742,17 @@ function fromEuler(out, x, y, z) {
1699
1742
  return out;
1700
1743
  }
1701
1744
  /**
1745
+ * Creates a new quat initialized with the given values
1746
+ *
1747
+ * @param {Number} x X component
1748
+ * @param {Number} y Y component
1749
+ * @param {Number} z Z component
1750
+ * @param {Number} w W component
1751
+ * @returns {quat} a new quaternion
1752
+ * @function
1753
+ */
1754
+ var fromValues$2 = fromValues$3;
1755
+ /**
1702
1756
  * Normalize a quat
1703
1757
  *
1704
1758
  * @param {quat} out the receiving quaternion
@@ -1778,18 +1832,6 @@ function create() {
1778
1832
  return out;
1779
1833
  }
1780
1834
  /**
1781
- * Creates a new vec2 initialized with values from an existing vector
1782
- *
1783
- * @param {ReadonlyVec2} a vector to clone
1784
- * @returns {vec2} a new 2D vector
1785
- */
1786
- function clone$1(a) {
1787
- var out = new ARRAY_TYPE(2);
1788
- out[0] = a[0];
1789
- out[1] = a[1];
1790
- return out;
1791
- }
1792
- /**
1793
1835
  * Creates a new vec2 initialized with the given values
1794
1836
  *
1795
1837
  * @param {Number} x X component
@@ -1803,32 +1845,6 @@ function fromValues(x, y) {
1803
1845
  return out;
1804
1846
  }
1805
1847
  /**
1806
- * Adds two vec2's
1807
- *
1808
- * @param {vec2} out the receiving vector
1809
- * @param {ReadonlyVec2} a the first operand
1810
- * @param {ReadonlyVec2} b the second operand
1811
- * @returns {vec2} out
1812
- */
1813
- function add(out, a, b) {
1814
- out[0] = a[0] + b[0];
1815
- out[1] = a[1] + b[1];
1816
- return out;
1817
- }
1818
- /**
1819
- * Subtracts vector b from vector a
1820
- *
1821
- * @param {vec2} out the receiving vector
1822
- * @param {ReadonlyVec2} a the first operand
1823
- * @param {ReadonlyVec2} b the second operand
1824
- * @returns {vec2} out
1825
- */
1826
- function subtract(out, a, b) {
1827
- out[0] = a[0] - b[0];
1828
- out[1] = a[1] - b[1];
1829
- return out;
1830
- }
1831
- /**
1832
1848
  * Scales a vec2 by a scalar number
1833
1849
  *
1834
1850
  * @param {vec2} out the receiving vector
@@ -1842,20 +1858,6 @@ function scale(out, a, b) {
1842
1858
  return out;
1843
1859
  }
1844
1860
  /**
1845
- * Adds two vec2's after scaling the second operand by a scalar value
1846
- *
1847
- * @param {vec2} out the receiving vector
1848
- * @param {ReadonlyVec2} a the first operand
1849
- * @param {ReadonlyVec2} b the second operand
1850
- * @param {Number} scale the amount to scale b by before adding
1851
- * @returns {vec2} out
1852
- */
1853
- function scaleAndAdd(out, a, b, scale) {
1854
- out[0] = a[0] + b[0] * scale;
1855
- out[1] = a[1] + b[1] * scale;
1856
- return out;
1857
- }
1858
- /**
1859
1861
  * Calculates the length of a vec2
1860
1862
  *
1861
1863
  * @param {ReadonlyVec2} a vector to calculate length of
@@ -1876,21 +1878,6 @@ function squaredLength(a) {
1876
1878
  return x * x + y * y;
1877
1879
  }
1878
1880
  /**
1879
- * Normalize a vec2
1880
- *
1881
- * @param {vec2} out the receiving vector
1882
- * @param {ReadonlyVec2} a vector to normalize
1883
- * @returns {vec2} out
1884
- */
1885
- function normalize(out, a) {
1886
- var x = a[0], y = a[1];
1887
- var len = x * x + y * y;
1888
- if (len > 0) len = 1 / Math.sqrt(len);
1889
- out[0] = a[0] * len;
1890
- out[1] = a[1] * len;
1891
- return out;
1892
- }
1893
- /**
1894
1881
  * Calculates the dot product of two vec2's
1895
1882
  *
1896
1883
  * @param {ReadonlyVec2} a the first operand
@@ -1901,30 +1888,6 @@ function dot$1(a, b) {
1901
1888
  return a[0] * b[0] + a[1] * b[1];
1902
1889
  }
1903
1890
  /**
1904
- * Rotate a 2D vector
1905
- * @param {vec2} out The receiving vec2
1906
- * @param {ReadonlyVec2} a The vec2 point to rotate
1907
- * @param {ReadonlyVec2} b The origin of the rotation
1908
- * @param {Number} rad The angle of rotation in radians
1909
- * @returns {vec2} out
1910
- */
1911
- function rotate(out, a, b, rad) {
1912
- var p0 = a[0] - b[0], p1 = a[1] - b[1], sinC = Math.sin(rad), cosC = Math.cos(rad);
1913
- out[0] = p0 * cosC - p1 * sinC + b[0];
1914
- out[1] = p0 * sinC + p1 * cosC + b[1];
1915
- return out;
1916
- }
1917
- /**
1918
- * Get the smallest angle between two 2D vectors
1919
- * @param {ReadonlyVec2} a The first operand
1920
- * @param {ReadonlyVec2} b The second operand
1921
- * @returns {Number} The angle in radians
1922
- */
1923
- function angle(a, b) {
1924
- var ax = a[0], ay = a[1], bx = b[0], by = b[1];
1925
- return Math.abs(Math.atan2(ay * bx - ax * by, ax * bx + ay * by));
1926
- }
1927
- /**
1928
1891
  * Set the components of a vec2 to zero
1929
1892
  *
1930
1893
  * @param {vec2} out the receiving vector
@@ -1936,11 +1899,6 @@ function zero(out) {
1936
1899
  return out;
1937
1900
  }
1938
1901
  /**
1939
- * Alias for {@link vec2.subtract}
1940
- * @function
1941
- */
1942
- var sub = subtract;
1943
- /**
1944
1902
  * Alias for {@link vec2.squaredLength}
1945
1903
  * @function
1946
1904
  */
@@ -3167,23 +3125,23 @@ var Evented = class {
3167
3125
  return this;
3168
3126
  }
3169
3127
  fire(event, properties) {
3170
- if (typeof event === "string") event = new Event(event, properties || {});
3171
- const type = event.type;
3128
+ const firedEvent = typeof event === "string" ? new Event(event, properties || {}) : event;
3129
+ const type = firedEvent.type;
3172
3130
  if (this.listens(type)) {
3173
- event.target = this;
3174
- const listeners = this._listeners?.[type] ? this._listeners[type].slice() : [];
3175
- for (const listener of listeners) listener.call(this, event);
3176
- const oneTimeListeners = this._oneTimeListeners?.[type] ? this._oneTimeListeners[type].slice() : [];
3131
+ firedEvent.target = this;
3132
+ const listeners = this._listeners?.[type]?.slice() ?? [];
3133
+ for (const listener of listeners) listener.call(this, firedEvent);
3134
+ const oneTimeListeners = this._oneTimeListeners?.[type]?.slice() ?? [];
3177
3135
  for (const listener of oneTimeListeners) {
3178
3136
  _removeEventListener(type, listener, this._oneTimeListeners);
3179
- listener.call(this, event);
3137
+ listener.call(this, firedEvent);
3180
3138
  }
3181
3139
  const parent = this._eventedParent;
3182
3140
  if (parent) {
3183
- extend(event, typeof this._eventedParentData === "function" ? this._eventedParentData() : this._eventedParentData);
3184
- parent.fire(event);
3141
+ extend(firedEvent, typeof this._eventedParentData === "function" ? this._eventedParentData() : this._eventedParentData);
3142
+ parent.fire(firedEvent);
3185
3143
  }
3186
- } else if (event instanceof ErrorEvent) console.error(event.error);
3144
+ } else if (firedEvent instanceof ErrorEvent) console.error(firedEvent.error);
3187
3145
  return this;
3188
3146
  }
3189
3147
  /**
@@ -3193,7 +3151,7 @@ var Evented = class {
3193
3151
  * @returns `true` if there is at least one registered listener for specified event type, `false` otherwise
3194
3152
  */
3195
3153
  listens(type) {
3196
- return this._listeners?.[type]?.length > 0 || this._oneTimeListeners?.[type]?.length > 0 || this._eventedParent?.listens(type);
3154
+ return Boolean(this._listeners?.[type]?.length || this._oneTimeListeners?.[type]?.length || this._eventedParent?.listens(type));
3197
3155
  }
3198
3156
  /**
3199
3157
  * Bubble all events fired by this instance of Evented to this parent instance of Evented.
@@ -15670,8 +15628,10 @@ var SourceExpressionBinder = class {
15670
15628
  }
15671
15629
  }
15672
15630
  upload(context) {
15673
- if (this.paintVertexArray?.arrayBuffer.byteLength) if (this.paintVertexBuffer?.buffer) this.paintVertexBuffer.updateData(this.paintVertexArray);
15674
- else this.paintVertexBuffer = context.createVertexBuffer(this.paintVertexArray, this.paintVertexAttributes, this.expression.isStateDependent);
15631
+ if (this.paintVertexArray?.arrayBuffer.byteLength) {
15632
+ if (this.paintVertexBuffer?.buffer) this.paintVertexBuffer.updateData(this.paintVertexArray);
15633
+ else this.paintVertexBuffer = context.createVertexBuffer(this.paintVertexArray, this.paintVertexAttributes, this.expression.isStateDependent);
15634
+ }
15675
15635
  }
15676
15636
  destroy() {
15677
15637
  if (this.paintVertexBuffer) this.paintVertexBuffer.destroy();
@@ -15716,8 +15676,10 @@ var CompositeExpressionBinder = class {
15716
15676
  }
15717
15677
  }
15718
15678
  upload(context) {
15719
- if (this.paintVertexArray?.arrayBuffer.byteLength) if (this.paintVertexBuffer?.buffer) this.paintVertexBuffer.updateData(this.paintVertexArray);
15720
- else this.paintVertexBuffer = context.createVertexBuffer(this.paintVertexArray, this.paintVertexAttributes, this.expression.isStateDependent);
15679
+ if (this.paintVertexArray?.arrayBuffer.byteLength) {
15680
+ if (this.paintVertexBuffer?.buffer) this.paintVertexBuffer.updateData(this.paintVertexArray);
15681
+ else this.paintVertexBuffer = context.createVertexBuffer(this.paintVertexArray, this.paintVertexAttributes, this.expression.isStateDependent);
15682
+ }
15721
15683
  }
15722
15684
  destroy() {
15723
15685
  if (this.paintVertexBuffer) this.paintVertexBuffer.destroy();
@@ -16831,6 +16793,8 @@ var Texture = class {
16831
16793
  gl.deleteTexture(this.texture);
16832
16794
  this.texture = gl.createTexture();
16833
16795
  this._ownedHandle = this.texture;
16796
+ this.filter = void 0;
16797
+ this.wrap = void 0;
16834
16798
  }
16835
16799
  gl.bindTexture(gl.TEXTURE_2D, this.texture);
16836
16800
  context.pixelStoreUnpackFlipY.set(false);
@@ -18280,8 +18244,10 @@ function subdivideVertexLine(linePoints, granularity, isRing = false) {
18280
18244
  const first = linePoints[0];
18281
18245
  const last = linePoints[linePoints.length - 1];
18282
18246
  const addLastToFirstSegment = isRing && (first.x !== last.x || first.y !== last.y);
18283
- if (granularity < 2) if (addLastToFirstSegment) return [...linePoints, linePoints[0]];
18284
- else return [...linePoints];
18247
+ if (granularity < 2) {
18248
+ if (addLastToFirstSegment) return [...linePoints, linePoints[0]];
18249
+ else return [...linePoints];
18250
+ }
18285
18251
  const cellSize = Math.floor(EXTENT$1 / granularity);
18286
18252
  const finalLineVertices = [];
18287
18253
  finalLineVertices.push(new Point(linePoints[0].x, linePoints[0].y));
@@ -18737,6 +18703,128 @@ const members$2 = layout$3.members;
18737
18703
  layout$3.size;
18738
18704
  layout$3.alignment;
18739
18705
  //#endregion
18706
+ //#region src/geo/bounds.ts
18707
+ /** A 2-d bounding box covering an X and Y range. */
18708
+ var Bounds = class Bounds {
18709
+ constructor() {
18710
+ this.minX = Infinity;
18711
+ this.maxX = -Infinity;
18712
+ this.minY = Infinity;
18713
+ this.maxY = -Infinity;
18714
+ }
18715
+ /**
18716
+ * Expands this bounding box to include point.
18717
+ *
18718
+ * @param point - The point to include in this bounding box
18719
+ * @returns This mutated bounding box
18720
+ */
18721
+ extend(point) {
18722
+ this.minX = Math.min(this.minX, point.x);
18723
+ this.minY = Math.min(this.minY, point.y);
18724
+ this.maxX = Math.max(this.maxX, point.x);
18725
+ this.maxY = Math.max(this.maxY, point.y);
18726
+ return this;
18727
+ }
18728
+ /**
18729
+ * Expands this bounding box by a fixed amount in each direction.
18730
+ *
18731
+ * @param amount - The amount to expand the box by, or contract if negative
18732
+ * @returns This mutated bounding box
18733
+ */
18734
+ expandBy(amount) {
18735
+ this.minX -= amount;
18736
+ this.minY -= amount;
18737
+ this.maxX += amount;
18738
+ this.maxY += amount;
18739
+ if (this.minX > this.maxX || this.minY > this.maxY) {
18740
+ this.minX = Infinity;
18741
+ this.maxX = -Infinity;
18742
+ this.minY = Infinity;
18743
+ this.maxY = -Infinity;
18744
+ }
18745
+ return this;
18746
+ }
18747
+ /**
18748
+ * Shrinks this bounding box by a fixed amount in each direction.
18749
+ *
18750
+ * @param amount - The amount to shrink the box by
18751
+ * @returns This mutated bounding box
18752
+ */
18753
+ shrinkBy(amount) {
18754
+ return this.expandBy(-amount);
18755
+ }
18756
+ /**
18757
+ * Returns a new bounding box that contains all of the corners of this bounding
18758
+ * box with a transform applied. Does not modify this bounding box.
18759
+ *
18760
+ * @param fn - The function to apply to each corner
18761
+ * @returns A new bounding box containing all of the mapped points.
18762
+ */
18763
+ map(fn) {
18764
+ const result = new Bounds();
18765
+ result.extend(fn(new Point(this.minX, this.minY)));
18766
+ result.extend(fn(new Point(this.maxX, this.minY)));
18767
+ result.extend(fn(new Point(this.minX, this.maxY)));
18768
+ result.extend(fn(new Point(this.maxX, this.maxY)));
18769
+ return result;
18770
+ }
18771
+ /**
18772
+ * Creates a new bounding box that includes all points provided.
18773
+ *
18774
+ * @param points - The points to include inside the bounding box
18775
+ * @returns The new bounding box
18776
+ */
18777
+ static fromPoints(points) {
18778
+ const result = new Bounds();
18779
+ for (const p of points) result.extend(p);
18780
+ return result;
18781
+ }
18782
+ contains(point) {
18783
+ return point.x >= this.minX && point.x <= this.maxX && point.y >= this.minY && point.y <= this.maxY;
18784
+ }
18785
+ empty() {
18786
+ return this.minX > this.maxX;
18787
+ }
18788
+ width() {
18789
+ return this.maxX - this.minX;
18790
+ }
18791
+ height() {
18792
+ return this.maxY - this.minY;
18793
+ }
18794
+ covers(other) {
18795
+ return !this.empty() && !other.empty() && other.minX >= this.minX && other.maxX <= this.maxX && other.minY >= this.minY && other.maxY <= this.maxY;
18796
+ }
18797
+ intersects(other) {
18798
+ return !this.empty() && !other.empty() && other.minX <= this.maxX && other.maxX >= this.minX && other.minY <= this.maxY && other.maxY >= this.minY;
18799
+ }
18800
+ };
18801
+ //#endregion
18802
+ //#region src/data/extent_bounds.ts
18803
+ /**
18804
+ * The bounding box covering the entire extent of a tile.
18805
+ */
18806
+ const EXTENT_BOUNDS = Bounds.fromPoints([new Point(0, 0), new Point(EXTENT$1, EXTENT$1)]);
18807
+ /**
18808
+ * Whether an edge runs along one of the lines the tile was cut out of the world at. Clipping happens
18809
+ * on the buffer rectangle, outside the tile, so an axis parallel edge out there belongs to the cut
18810
+ * rather than to the feature. Such an edge is shared with the neighbouring tile, which cuts the same
18811
+ * feature somewhere else, so geometry derived from it has to stay identical in both tiles.
18812
+ * @param p1 - First vertex of the edge
18813
+ * @param p2 - Second vertex of the edge
18814
+ * @returns True when the edge lies on a clip line.
18815
+ */
18816
+ function isBoundaryEdge(p1, p2) {
18817
+ return p1.x === p2.x && (p1.x < 0 || p1.x > 8192) || p1.y === p2.y && (p1.y < 0 || p1.y > 8192);
18818
+ }
18819
+ /**
18820
+ * Whether a ring lies completely off one side of the tile, and so cannot contribute a visible pixel.
18821
+ * @param ring - Ring to test
18822
+ * @returns True when every vertex is beyond the same edge of the tile.
18823
+ */
18824
+ function isEntirelyOutside(ring) {
18825
+ return ring.every((p) => p.x < 0) || ring.every((p) => p.x > 8192) || ring.every((p) => p.y < 0) || ring.every((p) => p.y > 8192);
18826
+ }
18827
+ //#endregion
18740
18828
  //#region node_modules/@mapbox/vector-tile/index.js
18741
18829
  /** @import {PbfReader} from 'pbf' */
18742
18830
  /** @import {Feature} from 'geojson' */
@@ -19373,55 +19461,90 @@ function getTileUnitsForMeters(distanceInMeters, canonical) {
19373
19461
  const tileUnitsPerMercator = (1 << canonical.z) * EXTENT$1;
19374
19462
  return distanceInMeters * meterInMercator * tileUnitsPerMercator;
19375
19463
  }
19464
+ /**
19465
+ * Rounds the corners of a single ring.
19466
+ *
19467
+ * Corners that tile clipping created are left sharp: they belong to the cut rather than to the
19468
+ * feature, and the neighbouring tile cuts the same feature elsewhere, so rounding them would leave
19469
+ * the two halves out of step. Every vertex ends up on the integer tile grid, because triangulation,
19470
+ * subdivision and the vertex buffers snap and deduplicate vertices there - arcs finer than a tile
19471
+ * unit would otherwise be merged only after they were triangulated, turning the mesh into spikes.
19472
+ *
19473
+ * A ring that collapses into fewer than three distinct vertices is returned unchanged.
19474
+ * @param ring - Ring to round, closed or open
19475
+ * @param distanceInTileUnits - Corner rounding distance, already converted to tile units
19476
+ */
19376
19477
  function roundRing(ring, distanceInTileUnits) {
19377
19478
  if (!ring || ring.length < 3) return ring;
19378
19479
  const isClosed = ring[0].x === ring[ring.length - 1].x && ring[0].y === ring[ring.length - 1].y;
19379
19480
  const vertexCount = isClosed ? ring.length - 1 : ring.length;
19380
19481
  if (vertexCount < 3) return ring;
19381
- const vertices = ring.map((p) => fromValues(p.x, p.y));
19382
19482
  const newRing = [];
19383
19483
  for (let i = 0; i < vertexCount; i++) {
19384
- const prev = vertices[(i - 1 + vertexCount) % vertexCount];
19385
- const current = vertices[i];
19386
- const next = vertices[(i + 1) % vertexCount];
19387
- appendRoundCorner(newRing, prev, current, next, distanceInTileUnits);
19484
+ const previous = ring[(i - 1 + vertexCount) % vertexCount];
19485
+ const current = ring[i];
19486
+ const next = ring[(i + 1) % vertexCount];
19487
+ if (isBoundaryEdge(previous, current) || isBoundaryEdge(current, next)) {
19488
+ newRing.push(current.clone());
19489
+ continue;
19490
+ }
19491
+ appendRoundCorner(newRing, previous, current, next, distanceInTileUnits);
19492
+ }
19493
+ const snapped = snapToIntegerGrid(newRing);
19494
+ if (snapped.length < 3) return ring;
19495
+ if (isClosed) snapped.push(snapped[0].clone());
19496
+ return snapped;
19497
+ }
19498
+ /**
19499
+ * Rounds every vertex to the integer tile grid, dropping vertices that collapse onto their neighbour.
19500
+ * The ring is treated as closed, so the wrap-around duplicate is dropped as well.
19501
+ * @param ring - Ring to snap
19502
+ */
19503
+ function snapToIntegerGrid(ring) {
19504
+ const snapped = [];
19505
+ for (const p of ring) {
19506
+ const point = p.round();
19507
+ const previous = snapped[snapped.length - 1];
19508
+ if (previous?.x === point.x && previous?.y === point.y) continue;
19509
+ snapped.push(point);
19388
19510
  }
19389
- if (isClosed && newRing.length > 0) newRing.push(clone$1(newRing[0]));
19390
- return newRing.map((p) => new Point(p[0], p[1]));
19511
+ while (snapped.length > 1 && snapped[0].x === snapped[snapped.length - 1].x && snapped[0].y === snapped[snapped.length - 1].y) snapped.pop();
19512
+ return snapped;
19391
19513
  }
19514
+ /**
19515
+ * Appends the arc that replaces one corner, or the corner itself when it is too shallow or too sharp
19516
+ * to round.
19517
+ * @param newRing - Ring being built, the arc points are appended to it
19518
+ * @param prev - Vertex before the corner
19519
+ * @param current - The corner
19520
+ * @param next - Vertex after the corner
19521
+ * @param distanceInTileUnits - Corner rounding distance, already converted to tile units
19522
+ */
19392
19523
  function appendRoundCorner(newRing, prev, current, next, distanceInTileUnits) {
19393
- const ua = sub(create(), prev, current);
19394
- const ub = sub(create(), next, current);
19395
- const lenA = length(ua);
19396
- const lenB = length(ub);
19524
+ const ua = prev.sub(current);
19525
+ const ub = next.sub(current);
19526
+ const lenA = ua.mag();
19527
+ const lenB = ub.mag();
19397
19528
  if (lenA < 1e-6 || lenB < 1e-6) {
19398
- newRing.push(clone$1(current));
19529
+ newRing.push(current.clone());
19399
19530
  return;
19400
19531
  }
19401
- scale(ua, ua, 1 / lenA);
19402
- scale(ub, ub, 1 / lenB);
19403
- const dot = dot$1(ua, ub);
19532
+ ua._div(lenA);
19533
+ ub._div(lenB);
19534
+ const dot = ua.x * ub.x + ua.y * ub.y;
19404
19535
  if (Math.abs(dot) > Math.cos(5 * Math.PI / 180)) {
19405
- newRing.push(clone$1(current));
19536
+ newRing.push(current.clone());
19406
19537
  return;
19407
19538
  }
19408
19539
  const maxEdgeLenPercent = .2;
19409
19540
  const r = Math.min(distanceInTileUnits, lenA * maxEdgeLenPercent, lenB * maxEdgeLenPercent);
19410
- const tangentA = scaleAndAdd(create(), current, ua, r);
19411
- const tangentB = scaleAndAdd(create(), current, ub, r);
19412
- const bisector = add(create(), ua, ub);
19413
- normalize(bisector, bisector);
19541
+ const tangentA = current.add(ua.mult(r));
19542
+ const tangentB = current.add(ub.mult(r));
19414
19543
  const cosHalfTheta = Math.sqrt((1 + dot) / 2);
19415
- const center = scaleAndAdd(create(), current, bisector, r / cosHalfTheta);
19416
- const radiusA = sub(create(), tangentA, center);
19417
- const radiusB = sub(create(), tangentB, center);
19418
- const sweepAngle = angle(radiusA, radiusB);
19419
- const direction = Math.sign(radiusA[0] * radiusB[1] - radiusA[1] * radiusB[0]);
19420
- const numSegments = Math.max(2, Math.ceil(sweepAngle / (Math.PI / 6) - 1e-6));
19421
- for (let s = 0; s <= numSegments; s++) {
19422
- const angle = direction * sweepAngle * (s / numSegments);
19423
- newRing.push(rotate(create(), tangentA, center, angle));
19424
- }
19544
+ const center = current.add(ua.add(ub)._unit()._mult(r / cosHalfTheta));
19545
+ const sweepAngle = tangentA.sub(center).angleWith(tangentB.sub(center));
19546
+ const numSegments = Math.max(2, Math.ceil(Math.abs(sweepAngle) / (Math.PI / 6) - 1e-6));
19547
+ for (let s = 0; s <= numSegments; s++) newRing.push(tangentA.rotateAround(sweepAngle * (s / numSegments), center));
19425
19548
  }
19426
19549
  //#endregion
19427
19550
  //#region src/data/bucket/fill_extrusion_bucket.ts
@@ -19589,12 +19712,6 @@ function accumulatePointsToCentroid(centroid, geometry) {
19589
19712
  }
19590
19713
  }
19591
19714
  register("FillExtrusionBucket", FillExtrusionBucket, { omit: ["layers", "features"] });
19592
- function isBoundaryEdge(p1, p2) {
19593
- return p1.x === p2.x && (p1.x < 0 || p1.x > 8192) || p1.y === p2.y && (p1.y < 0 || p1.y > 8192);
19594
- }
19595
- function isEntirelyOutside(ring) {
19596
- return ring.every((p) => p.x < 0) || ring.every((p) => p.x > 8192) || ring.every((p) => p.y < 0) || ring.every((p) => p.y > 8192);
19597
- }
19598
19715
  //#endregion
19599
19716
  //#region src/style/style_layer/fill_extrusion_style_layer_properties.g.ts
19600
19717
  let layout$2;
@@ -22655,8 +22772,10 @@ function getGlyphAdvance(codePoint, section, glyphMap, imagePositions, spacing,
22655
22772
  }
22656
22773
  function calculateBadness(lineWidth, targetWidth, penalty, isLastBreak) {
22657
22774
  const raggedness = Math.pow(lineWidth - targetWidth, 2);
22658
- if (isLastBreak) if (lineWidth < targetWidth) return raggedness / 2;
22659
- else return raggedness * 2;
22775
+ if (isLastBreak) {
22776
+ if (lineWidth < targetWidth) return raggedness / 2;
22777
+ else return raggedness * 2;
22778
+ }
22660
22779
  return raggedness + Math.abs(penalty) * penalty;
22661
22780
  }
22662
22781
  function calculatePenalty(codePoint, nextCodePoint, penalizableIdeographicBreak) {
@@ -23582,25 +23701,27 @@ function readUtf8$1(buf, pos, end) {
23582
23701
  function writeUtf8(buf, str, pos) {
23583
23702
  for (let i = 0, c, lead; i < str.length; i++) {
23584
23703
  c = str.charCodeAt(i);
23585
- if (c > 55295 && c < 57344) if (lead) if (c < 56320) {
23586
- buf[pos++] = 239;
23587
- buf[pos++] = 191;
23588
- buf[pos++] = 189;
23589
- lead = c;
23590
- continue;
23591
- } else {
23592
- c = lead - 55296 << 10 | c - 56320 | 65536;
23593
- lead = null;
23594
- }
23595
- else {
23596
- if (c > 56319 || i + 1 === str.length) {
23597
- buf[pos++] = 239;
23598
- buf[pos++] = 191;
23599
- buf[pos++] = 189;
23600
- } else lead = c;
23601
- continue;
23602
- }
23603
- else if (lead) {
23704
+ if (c > 55295 && c < 57344) {
23705
+ if (lead) {
23706
+ if (c < 56320) {
23707
+ buf[pos++] = 239;
23708
+ buf[pos++] = 191;
23709
+ buf[pos++] = 189;
23710
+ lead = c;
23711
+ continue;
23712
+ } else {
23713
+ c = lead - 55296 << 10 | c - 56320 | 65536;
23714
+ lead = null;
23715
+ }
23716
+ } else {
23717
+ if (c > 56319 || i + 1 === str.length) {
23718
+ buf[pos++] = 239;
23719
+ buf[pos++] = 191;
23720
+ buf[pos++] = 189;
23721
+ } else lead = c;
23722
+ continue;
23723
+ }
23724
+ } else if (lead) {
23604
23725
  buf[pos++] = 239;
23605
23726
  buf[pos++] = 191;
23606
23727
  buf[pos++] = 189;
@@ -23656,15 +23777,15 @@ function readGlyph(tag, glyph, pbf) {
23656
23777
  function parseGlyphPbf(data) {
23657
23778
  return new PbfReader(data).readFields(readFontstacks, []);
23658
23779
  }
23780
+ function isStyleImageWebGLData(data) {
23781
+ return typeof data?.renderWithWebGL === "function";
23782
+ }
23659
23783
  function renderStyleImage(image) {
23660
23784
  const { userImage } = image;
23661
- if (userImage?.render) {
23662
- if (userImage.render()) {
23663
- image.data.replace(new Uint8Array(userImage.data.buffer));
23664
- return true;
23665
- }
23666
- }
23667
- return false;
23785
+ if (!userImage?.render) return false;
23786
+ if (!userImage.render()) return false;
23787
+ if (!isStyleImageWebGLData(userImage.data)) image.data.replace(new Uint8Array(userImage.data.buffer));
23788
+ return true;
23668
23789
  }
23669
23790
  //#endregion
23670
23791
  //#region node_modules/potpack/index.js
@@ -23741,13 +23862,14 @@ function potpack(boxes) {
23741
23862
  };
23742
23863
  }
23743
23864
  var ImagePosition = class {
23744
- constructor(paddedRect, { pixelRatio, version, stretchX, stretchY, content, textFitWidth, textFitHeight }) {
23865
+ constructor(paddedRect, { pixelRatio, version, isWebGLImage = false, stretchX, stretchY, content, textFitWidth, textFitHeight }) {
23745
23866
  this.paddedRect = paddedRect;
23746
23867
  this.pixelRatio = pixelRatio;
23747
23868
  this.stretchX = stretchX;
23748
23869
  this.stretchY = stretchY;
23749
23870
  this.content = content;
23750
23871
  this.version = version;
23872
+ this.needsFirstWebGLRender = isWebGLImage;
23751
23873
  this.textFitWidth = textFitWidth;
23752
23874
  this.textFitHeight = textFitHeight;
23753
23875
  }
@@ -23765,12 +23887,17 @@ var ImagePosition = class {
23765
23887
  }
23766
23888
  };
23767
23889
  /**
23768
- * A class holding all the images
23890
+ * A single tile's packed copy of the icons and patterns its features reference, built in the
23891
+ * worker so that the symbol layout can bake the positions within it straight into the vertex
23892
+ * buffers. Each tile owns one, along with the texture it is uploaded to - as opposed to
23893
+ * {@link ImageManager}, which owns the images of the whole style.
23894
+ * @internal
23769
23895
  */
23770
23896
  var ImageAtlas = class {
23771
23897
  constructor(icons, patterns) {
23772
23898
  const iconPositions = {}, patternPositions = {};
23773
23899
  this.haveRenderCallbacks = [];
23900
+ this.patchedUpdateVersion = -1;
23774
23901
  const bins = [];
23775
23902
  this.addImages(icons, iconPositions, bins);
23776
23903
  this.addImages(patterns, patternPositions, bins);
@@ -23781,6 +23908,7 @@ var ImageAtlas = class {
23781
23908
  });
23782
23909
  for (const id in icons) {
23783
23910
  const src = icons[id];
23911
+ if (src.isWebGLImage) continue;
23784
23912
  const bin = iconPositions[id].paddedRect;
23785
23913
  RGBAImage.copy(src.data, image, {
23786
23914
  x: 0,
@@ -23860,22 +23988,52 @@ var ImageAtlas = class {
23860
23988
  if (src.hasRenderCallback) this.haveRenderCallbacks.push(id);
23861
23989
  }
23862
23990
  }
23991
+ /**
23992
+ * Brings this atlas' texture back in sync with the images it was built from, re-uploading the
23993
+ * ones that were replaced in the meantime.
23994
+ *
23995
+ * This runs for every in-view tile on every frame, so the common case of nothing having
23996
+ * changed has to cost nothing: a single comparison against {@link ImageManager.updateVersion}
23997
+ * ends the call. When something did change, only the images this atlas actually holds are
23998
+ * looked at - a handful per tile - and {@link ImageAtlas.patchUpdatedImage} then skips the
23999
+ * ones whose version still matches, leaving just the genuinely stale ones to upload.
24000
+ *
24001
+ * The render callbacks are dispatched first because they may update images themselves, and
24002
+ * those updates have to be part of the version this call catches up with - otherwise an
24003
+ * animated image would always be uploaded a frame late.
24004
+ */
23863
24005
  patchUpdatedImages(imageManager, texture) {
23864
24006
  imageManager.dispatchRenderCallbacks(this.haveRenderCallbacks);
23865
- for (const name in imageManager.updatedImages) {
23866
- this.patchUpdatedImage(this.iconPositions[name], imageManager.getImage(name), texture);
23867
- this.patchUpdatedImage(this.patternPositions[name], imageManager.getImage(name), texture);
23868
- }
24007
+ if (this.patchedUpdateVersion === imageManager.updateVersion) return;
24008
+ this.patchedUpdateVersion = imageManager.updateVersion;
24009
+ for (const name in this.iconPositions) this.patchUpdatedImage(this.iconPositions[name], imageManager.getImage(name), texture);
24010
+ for (const name in this.patternPositions) this.patchUpdatedImage(this.patternPositions[name], imageManager.getImage(name), texture);
23869
24011
  }
23870
24012
  patchUpdatedImage(position, image, texture) {
23871
24013
  if (!position || !image) return;
23872
- if (position.version === image.version) return;
24014
+ if (!position.needsFirstWebGLRender && position.version === image.version) return;
24015
+ position.needsFirstWebGLRender = false;
23873
24016
  position.version = image.version;
23874
24017
  const [x, y] = position.tl;
23875
- texture.update(image.data, void 0, {
24018
+ const data = image.userImage?.data;
24019
+ if (!isStyleImageWebGLData(data)) {
24020
+ texture.update(image.data, void 0, {
24021
+ x,
24022
+ y
24023
+ });
24024
+ return;
24025
+ }
24026
+ const { width, height } = image.data;
24027
+ texture.context.setCustomLayerDefaults();
24028
+ data.renderWithWebGL({
24029
+ gl: texture.context.gl,
24030
+ texture: texture.texture,
23876
24031
  x,
23877
- y
24032
+ y,
24033
+ width,
24034
+ height
23878
24035
  });
24036
+ texture.context.setDirty();
23879
24037
  }
23880
24038
  };
23881
24039
  register("ImagePosition", ImagePosition);
@@ -24952,10 +25110,14 @@ var SymbolStyleLayer = class SymbolStyleLayer extends StyleLayer {
24952
25110
  }
24953
25111
  recalculate(parameters, availableImages) {
24954
25112
  super.recalculate(parameters, availableImages);
24955
- if (this.layout.get("icon-rotation-alignment") === "auto") if (this.layout.get("symbol-placement") !== "point") this.layout._values["icon-rotation-alignment"] = "map";
24956
- else this.layout._values["icon-rotation-alignment"] = "viewport";
24957
- if (this.layout.get("text-rotation-alignment") === "auto") if (this.layout.get("symbol-placement") !== "point") this.layout._values["text-rotation-alignment"] = "map";
24958
- else this.layout._values["text-rotation-alignment"] = "viewport";
25113
+ if (this.layout.get("icon-rotation-alignment") === "auto") {
25114
+ if (this.layout.get("symbol-placement") !== "point") this.layout._values["icon-rotation-alignment"] = "map";
25115
+ else this.layout._values["icon-rotation-alignment"] = "viewport";
25116
+ }
25117
+ if (this.layout.get("text-rotation-alignment") === "auto") {
25118
+ if (this.layout.get("symbol-placement") !== "point") this.layout._values["text-rotation-alignment"] = "map";
25119
+ else this.layout._values["text-rotation-alignment"] = "viewport";
25120
+ }
24959
25121
  if (this.layout.get("text-pitch-alignment") === "auto") this.layout._values["text-pitch-alignment"] = this.layout.get("text-rotation-alignment") === "map" ? "map" : "viewport";
24960
25122
  if (this.layout.get("icon-pitch-alignment") === "auto") this.layout._values["icon-pitch-alignment"] = this.layout.get("icon-rotation-alignment");
24961
25123
  if (this.layout.get("symbol-placement") === "point") {
@@ -25537,102 +25699,6 @@ function compareTileId(a, b) {
25537
25699
  register("CanonicalTileID", CanonicalTileID);
25538
25700
  register("OverscaledTileID", OverscaledTileID, { omit: ["terrainRttPosMatrix32f"] });
25539
25701
  //#endregion
25540
- //#region src/geo/bounds.ts
25541
- /** A 2-d bounding box covering an X and Y range. */
25542
- var Bounds = class Bounds {
25543
- constructor() {
25544
- this.minX = Infinity;
25545
- this.maxX = -Infinity;
25546
- this.minY = Infinity;
25547
- this.maxY = -Infinity;
25548
- }
25549
- /**
25550
- * Expands this bounding box to include point.
25551
- *
25552
- * @param point - The point to include in this bounding box
25553
- * @returns This mutated bounding box
25554
- */
25555
- extend(point) {
25556
- this.minX = Math.min(this.minX, point.x);
25557
- this.minY = Math.min(this.minY, point.y);
25558
- this.maxX = Math.max(this.maxX, point.x);
25559
- this.maxY = Math.max(this.maxY, point.y);
25560
- return this;
25561
- }
25562
- /**
25563
- * Expands this bounding box by a fixed amount in each direction.
25564
- *
25565
- * @param amount - The amount to expand the box by, or contract if negative
25566
- * @returns This mutated bounding box
25567
- */
25568
- expandBy(amount) {
25569
- this.minX -= amount;
25570
- this.minY -= amount;
25571
- this.maxX += amount;
25572
- this.maxY += amount;
25573
- if (this.minX > this.maxX || this.minY > this.maxY) {
25574
- this.minX = Infinity;
25575
- this.maxX = -Infinity;
25576
- this.minY = Infinity;
25577
- this.maxY = -Infinity;
25578
- }
25579
- return this;
25580
- }
25581
- /**
25582
- * Shrinks this bounding box by a fixed amount in each direction.
25583
- *
25584
- * @param amount - The amount to shrink the box by
25585
- * @returns This mutated bounding box
25586
- */
25587
- shrinkBy(amount) {
25588
- return this.expandBy(-amount);
25589
- }
25590
- /**
25591
- * Returns a new bounding box that contains all of the corners of this bounding
25592
- * box with a transform applied. Does not modify this bounding box.
25593
- *
25594
- * @param fn - The function to apply to each corner
25595
- * @returns A new bounding box containing all of the mapped points.
25596
- */
25597
- map(fn) {
25598
- const result = new Bounds();
25599
- result.extend(fn(new Point(this.minX, this.minY)));
25600
- result.extend(fn(new Point(this.maxX, this.minY)));
25601
- result.extend(fn(new Point(this.minX, this.maxY)));
25602
- result.extend(fn(new Point(this.maxX, this.maxY)));
25603
- return result;
25604
- }
25605
- /**
25606
- * Creates a new bounding box that includes all points provided.
25607
- *
25608
- * @param points - The points to include inside the bounding box
25609
- * @returns The new bounding box
25610
- */
25611
- static fromPoints(points) {
25612
- const result = new Bounds();
25613
- for (const p of points) result.extend(p);
25614
- return result;
25615
- }
25616
- contains(point) {
25617
- return point.x >= this.minX && point.x <= this.maxX && point.y >= this.minY && point.y <= this.maxY;
25618
- }
25619
- empty() {
25620
- return this.minX > this.maxX;
25621
- }
25622
- width() {
25623
- return this.maxX - this.minX;
25624
- }
25625
- height() {
25626
- return this.maxY - this.minY;
25627
- }
25628
- covers(other) {
25629
- return !this.empty() && !other.empty() && other.minX >= this.minX && other.maxX <= this.maxX && other.minY >= this.minY && other.maxY <= this.maxY;
25630
- }
25631
- intersects(other) {
25632
- return !this.empty() && !other.empty() && other.minX <= this.maxX && other.maxX >= this.minX && other.minY <= this.maxY && other.maxY >= this.minY;
25633
- }
25634
- };
25635
- //#endregion
25636
25702
  //#region node_modules/@maplibre/vt-pbf/dist/index.es.js
25637
25703
  var FeatureWrapper = class {
25638
25704
  constructor(feature, extent) {
@@ -29877,8 +29943,10 @@ function decodeTile(tile, geometryScaling, idWithinMaxSafeInteger = true) {
29877
29943
  const numStreams = hasStreamCount(columnMetadata) ? decodeVarintInt32(tile, offset, 1)[0] : 1;
29878
29944
  if (numStreams === 0) continue;
29879
29945
  const propertyVector = decodePropertyColumn(tile, offset, columnMetadata, numStreams, numFeatures, void 0);
29880
- if (propertyVector) if (Array.isArray(propertyVector)) for (const property of propertyVector) propertyVectors.push(property);
29881
- else propertyVectors.push(propertyVector);
29946
+ if (propertyVector) {
29947
+ if (Array.isArray(propertyVector)) for (const property of propertyVector) propertyVectors.push(property);
29948
+ else propertyVectors.push(propertyVector);
29949
+ }
29882
29950
  }
29883
29951
  }
29884
29952
  const featureTable = new FeatureTable(featureTableMetadata.name, geometryVector, idVector, propertyVectors, extent);
@@ -30778,7 +30846,7 @@ function getGlyphQuads(anchor, shaping, textOffset, layer, alongLine, feature, i
30778
30846
  if (rotateVerticalGlyph) {
30779
30847
  const center = new Point(-halfAdvance, halfAdvance - -17);
30780
30848
  const verticalRotation = -Math.PI / 2;
30781
- const xHalfWidthOffsetCorrection = 24 / 2 - halfAdvance;
30849
+ const xHalfWidthOffsetCorrection = 12 - halfAdvance;
30782
30850
  const yImageOffsetCorrection = positionedGlyph.imageName ? xHalfWidthOffsetCorrection : 0;
30783
30851
  const halfWidthOffsetCorrection = new Point(22 - xHalfWidthOffsetCorrection, -yImageOffsetCorrection);
30784
30852
  const verticalOffsetCorrection = new Point(...verticalizedLabelOffset);
@@ -31403,6 +31471,6 @@ function anchorIsTooClose(bucket, text, repeatDistance, anchor) {
31403
31471
  return false;
31404
31472
  }
31405
31473
  //#endregion
31406
- export { tileCoordinatesToMercatorCoordinates as $, degreesToRadians as $n, clone$5 as $r, EvaluationParameters as $t, getOverlapMode as A, scale$5 as Ai, sameOrigin as An, rollPitchBearingToQuat as Ar, Uniform1i as At, PbfReader as B, angleToRotateBetweenVectors2D as Bn, pixelsToTileUnits as Br, CollisionCircleLayoutArray as Bt, createStyleLayer as C, invert$2 as Ci, AJAXError as Cn, pick as Cr, renderColorRamp as Ct, isSymbolStyleLayer as D, rotateX$3 as Di, getReferrer as Dn, readImageUsingVideoFrame as Dr, polygonIntersectsPolygon as Dt, isBackgroundStyleLayer as E, perspective as Ei, getJSON as En, rayPlaneIntersection as Er, isCircleStyleLayer as Et, ImageAtlas as F, invert$5 as Fi, AbortError as Fn, translatePosition as Fr, UniformColorArray as Ft, isFillExtrusionStyleLayer as G, clone as Gn, sqrLen as Gr, RasterBoundsArray as Gt, isLineStyleLayer as H, arrayBufferToImageBitmap as Hn, create as Hr, Pos3dArray as Ht, ImagePosition as I, rotate$4 as Ii, isAbortError as In, uniqueId as Ir, UniformFloatArray as It, cameraDirectionFromPitchBearing as J, createMat4f64 as Jn, slerp as Jr, isRasterStyleLayer as Jt, FillExtrusionBucket as K, createIdentityMat4f32 as Kn, zero as Kr, TriangleIndexArray as Kt, potpack as L, isOffscreenCanvasDistorted as Li, throwIfAborted as Ln, warnOnce as Lr, UniformMatrix4f as Lt, evaluateSizeForZoom as M, create$6 as Mi, getProtocol as Mn, sphericalToCartesian as Mr, Uniform3f as Mt, WritingMode as N, fromRotation$2 as Ni, removeProtocol as Nn, subscribe as Nr, Uniform4f as Nt, SymbolBucket as O, rotateY$3 as Oi, getVideo as On, remapSaturate as Or, toEvaluationFeature as Ot, getAnchorAlignment as P, create$8 as Pi, config as Pn, threePlaneIntersection as Pr, UniformColor as Pt, projectToWorldCoordinates as Q, defaultEasing as Qn, add$4 as Qr, Transitionable as Qt, renderStyleImage as R, offscreenCanvasSupported as Ri, JSON_PREFIX as Rn, wrap$1 as Rr, SegmentVector as Rt, Actor as S, identity$2 as Si, Evented as Sn, parseCacheControl as Sr, isHeatmapStyleLayer as St, validateCustomStyleLayer as T, ortho as Ti, getArrayBuffer as Tn, radiansToDegrees as Tr, RGBAImage as Tt, LineBucket as U, bezier as Un, length as Ur, PosArray as Ut, collisionCircleLayout as V, arrayBufferToImage as Vn, EXTENT$1 as Vr, LineStripIndexArray as Vt, GeoJSONVT as W, clamp$2 as Wn, scale as Wr, QuadTriangleArray as Wt, getMercatorHorizon as X, createVec4f64 as Xn, scale$3 as Xr, Properties as Xt, cameraMercatorCoordinateFromCenterAndRotation as Y, createVec3f64 as Yn, mul$3 as Yr, DataConstantProperty as Yt, maxMercatorHorizonAngle as Z, deepEqual$1 as Zn, transformMat4$1 as Zr, TRANSITION_SUFFIX as Zt, OverscaledTileID as _, copy$5 as _i, groupByLayout as _n, isWorker as _r, isColorReliefStyleLayer as _t, clipLine as a, normalize$4 as ai, emitValidationErrors as an, filterObject as ar, mercatorXfromLng as at, compareTileId as b, exactEquals$5 as bi, ErrorEvent as bn, mod as br, isHillshadeStyleLayer as bt, FeatureIndex as c, rotateZ$2 as ci, validateStyleAndEmit as cn, getAngleDelta as cr, LngLat as ct, DictionaryCoder as d, sub$2 as di, ValidationError as dn, getRollPitchBearing as dr, isFillStyleLayer as dt, cross$2 as ei, rtlWorkerPlugin as en, differenceOfAnglesDegrees as er, unprojectFromWorldCoordinates as et, GEOJSON_TILE_LAYER_NAME as f, transformMat3$1 as fi, createExpression as fn, isImageBitmap as fr, FillBucket as ft, CanonicalTileID as g, clone$6 as gi, featureFilter as gn, isTouchableOrPointableType as gr, SubdivisionGranularitySetting as gt, Bounds as h, zero$2 as hi, emptyStyle as hn, isTouchableEvent as hr, SubdivisionGranularityExpression as ht, clipGeometry as i, negate$2 as ii, SPEC_SOURCE_TYPES as in, extend as ir, lngFromMercatorX as it, evaluateSizeForFeature as j, translate$2 as ji, addProtocol as jn, scaleZoom as jr, Uniform2f as jt, addDynamicAttributes as k, rotateZ$3 as ki, makeRequest as kn, rollPitchBearingEqual as kr, Uniform1f as kt, MLTVectorTile as l, scale$4 as li, Color as ln, getEdgeTiles as lr, earthRadius as lt, fromVectorTileJs as m, transformQuat$1 as mi, diff as mn, isSafari as mr, SOUTH_POLE_Y as mt, performSymbolLayout as n, len$4 as ni, ZoomHistory as nn, ensureError as nr, altitudeFromMercatorZ as nt, BoundedLRUCache as o, rotateX$2 as oi, validateAndEmit as on, findLineIntersection as or, mercatorYfromLat as ot, GeoJSONWrapper as p, transformMat4$2 as pi, derefLayers as pn, isPointableEvent as pr, NORTH_POLE_Y as pt, calculateTileMatrix as q, createIdentityMat4f64 as qn, fromEuler as qr, createLayout as qt, TextAnchorEnum as r, length$4 as ri, register as rn, evaluateZoomSnap as rr, latFromMercatorY as rt, TileCache as s, rotateY$2 as si, validateStyle as sn, getAABB as sr, mercatorZfromAltitude as st, getAnchorJustification as t, dot$5 as ti, codePointUsesLocalIdeographFontFamily as tn, distanceOfAnglesRadians as tr, MercatorCoordinate as tt, GeoJSONFeature as u, scaleAndAdd$2 as ui, ProjectionDefinition as un, getImageData as ur, VectorTile as ut, UnwrappedTileID as v, create$5 as vi, interpolateFactory as vn, lerp as vr, DEMData as vt, isCustomStyleLayer as w, multiply$5 as wi, GLOBAL_DISPATCHER_ID as wn, pointPlaneSignedDistance as wr, AlphaImage as wt, isInBoundsForZoomLngLat as x, fromScaling as xi, Event as xn, nextPowerOfTwo as xr, HEATMAP_FULL_RENDER_FBO_KEY as xt, calculateTileKey as y, equals$6 as yi, latest as yn, mapObject as yr, Texture as yt, parseGlyphPbf as z, Point as zi, MAX_VALID_LATITUDE as zn, zoomScale as zr, CollisionBoxArray as zt };
31474
+ export { tileCoordinatesToMercatorCoordinates as $, deepEqual$1 as $n, mul$3 as $r, TRANSITION_SUFFIX as $t, evaluateSizeForFeature as A, perspective as Ai, getVideo as An, remapSaturate as Ar, toEvaluationFeature as At, PbfReader as B, invert$5 as Bi, JSON_PREFIX as Bn, wrap$1 as Br, SegmentVector as Bt, isCustomStyleLayer as C, equals$6 as Ci, Event as Cn, nextPowerOfTwo as Cr, HEATMAP_FULL_RENDER_FBO_KEY as Ct, SymbolBucket as D, invert$2 as Di, getArrayBuffer as Dn, radiansToDegrees as Dr, RGBAImage as Dt, isSymbolStyleLayer as E, identity$2 as Ei, GLOBAL_DISPATCHER_ID as En, pointPlaneSignedDistance as Er, AlphaImage as Et, ImagePosition as F, translate$2 as Fi, removeProtocol as Fn, subscribe as Fr, Uniform4f as Ft, isFillExtrusionStyleLayer as G, bezier as Gn, length as Gr, PosArray as Gt, isLineStyleLayer as H, isOffscreenCanvasDistorted as Hi, angleToRotateBetweenVectors2D as Hn, pixelsToTileUnits as Hr, CollisionCircleLayoutArray as Ht, potpack as I, create$6 as Ii, config as In, threePlaneIntersection as Ir, UniformColor as It, cameraDirectionFromPitchBearing as J, createIdentityMat4f32 as Jn, zero as Jr, TriangleIndexArray as Jt, FillExtrusionBucket as K, clamp$2 as Kn, scale as Kr, QuadTriangleArray as Kt, isStyleImageWebGLData as L, fromRotation$2 as Li, AbortError as Ln, translatePosition as Lr, UniformColorArray as Lt, WritingMode as M, rotateY$3 as Mi, sameOrigin as Mn, rollPitchBearingToQuat as Mr, Uniform1i as Mt, getAnchorAlignment as N, rotateZ$3 as Ni, addProtocol as Nn, scaleZoom as Nr, Uniform2f as Nt, addDynamicAttributes as O, multiply$5 as Oi, getJSON as On, rayPlaneIntersection as Or, isCircleStyleLayer as Ot, ImageAtlas as P, scale$5 as Pi, getProtocol as Pn, sphericalToCartesian as Pr, Uniform3f as Pt, projectToWorldCoordinates as Q, createVec4f64 as Qn, slerp as Qr, Properties as Qt, renderStyleImage as R, create$8 as Ri, isAbortError as Rn, uniqueId as Rr, UniformFloatArray as Rt, createStyleLayer as S, create$5 as Si, ErrorEvent as Sn, mod as Sr, isHillshadeStyleLayer as St, isBackgroundStyleLayer as T, fromScaling as Ti, AJAXError as Tn, pick as Tr, renderColorRamp as Tt, LineBucket as U, offscreenCanvasSupported as Ui, arrayBufferToImage as Un, EXTENT$1 as Ur, LineStripIndexArray as Ut, collisionCircleLayout as V, rotate$4 as Vi, MAX_VALID_LATITUDE as Vn, zoomScale as Vr, CollisionBoxArray as Vt, GeoJSONVT as W, Point as Wi, arrayBufferToImageBitmap as Wn, create as Wr, Pos3dArray as Wt, getMercatorHorizon as X, createMat4f64 as Xn, fromValues$2 as Xr, isRasterStyleLayer as Xt, cameraMercatorCoordinateFromCenterAndRotation as Y, createIdentityMat4f64 as Yn, fromEuler as Yr, createLayout as Yt, maxMercatorHorizonAngle as Z, createVec3f64 as Zn, multiply$2 as Zr, DataConstantProperty as Zt, UnwrappedTileID as _, transformMat4$2 as _i, emptyStyle as _n, isTouchableEvent as _r, SubdivisionGranularityExpression as _t, clipLine as a, dot$5 as ai, register as an, evaluateZoomSnap as ar, mercatorXfromLng as at, isInBoundsForZoomLngLat as b, clone$6 as bi, interpolateFactory as bn, lerp as br, DEMData as bt, FeatureIndex as c, negate$2 as ci, validateAndEmit as cn, findLineIntersection as cr, LngLat as ct, DictionaryCoder as d, rotateY$2 as di, Color as dn, getEdgeTiles as dr, EXTENT_BOUNDS as dt, scale$3 as ei, Transitionable as en, defaultEasing as er, unprojectFromWorldCoordinates as et, GEOJSON_TILE_LAYER_NAME as f, rotateZ$2 as fi, ProjectionDefinition as fn, getImageData as fr, Bounds as ft, OverscaledTileID as g, transformMat3$1 as gi, diff as gn, isSafari as gr, SOUTH_POLE_Y as gt, CanonicalTileID as h, sub$2 as hi, derefLayers as hn, isPointableEvent as hr, NORTH_POLE_Y as ht, clipGeometry as i, cross$2 as ii, ZoomHistory as in, ensureError as ir, lngFromMercatorX as it, evaluateSizeForZoom as j, rotateX$3 as ji, makeRequest as jn, rollPitchBearingEqual as jr, Uniform1f as jt, getOverlapMode as k, ortho as ki, getReferrer as kn, readImageUsingVideoFrame as kr, polygonIntersectsPolygon as kt, MLTVectorTile as l, normalize$4 as li, validateStyle as ln, getAABB as lr, earthRadius as lt, fromVectorTileJs as m, scaleAndAdd$2 as mi, createExpression as mn, isImageBitmap as mr, FillBucket as mt, performSymbolLayout as n, add$4 as ni, rtlWorkerPlugin as nn, differenceOfAnglesDegrees as nr, altitudeFromMercatorZ as nt, BoundedLRUCache as o, len$4 as oi, SPEC_SOURCE_TYPES as on, extend as or, mercatorYfromLat as ot, GeoJSONWrapper as p, scale$4 as pi, ValidationError as pn, getRollPitchBearing as pr, isFillStyleLayer as pt, calculateTileMatrix as q, clone as qn, sqrLen as qr, RasterBoundsArray as qt, TextAnchorEnum as r, clone$5 as ri, codePointUsesLocalIdeographFontFamily as rn, distanceOfAnglesRadians as rr, latFromMercatorY as rt, TileCache as s, length$4 as si, emitValidationErrors as sn, filterObject as sr, mercatorZfromAltitude as st, getAnchorJustification as t, transformMat4$1 as ti, EvaluationParameters as tn, degreesToRadians as tr, MercatorCoordinate as tt, GeoJSONFeature as u, rotateX$2 as ui, validateStyleAndEmit as un, getAngleDelta as ur, VectorTile as ut, calculateTileKey as v, transformQuat$1 as vi, featureFilter as vn, isTouchableOrPointableType as vr, SubdivisionGranularitySetting as vt, validateCustomStyleLayer as w, exactEquals$5 as wi, Evented as wn, parseCacheControl as wr, isHeatmapStyleLayer as wt, Actor as x, copy$5 as xi, latest as xn, mapObject as xr, Texture as xt, compareTileId as y, zero$2 as yi, groupByLayout as yn, isWorker as yr, isColorReliefStyleLayer as yt, parseGlyphPbf as z, determinant$3 as zi, throwIfAborted as zn, warnOnce as zr, UniformMatrix4f as zt };
31407
31475
 
31408
31476
  //# sourceMappingURL=maplibre-gl-shared-dev.mjs.map