maplibre-gl 3.2.0 → 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 (88) hide show
  1. package/build/generate-docs.ts +1 -1
  2. package/build/generate-struct-arrays.ts +3 -2
  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 +351 -281
  8. package/dist/maplibre-gl-dev.js.map +1 -1
  9. package/dist/maplibre-gl.d.ts +254 -181
  10. package/dist/maplibre-gl.js +4 -4
  11. package/dist/maplibre-gl.js.map +1 -1
  12. package/package.json +30 -30
  13. package/src/data/array_types.g.ts +32 -10
  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_bucket.ts +1 -0
  17. package/src/data/feature_index.ts +1 -0
  18. package/src/data/program_configuration.ts +1 -0
  19. package/src/data/segment.ts +2 -0
  20. package/src/geo/transform.test.ts +9 -16
  21. package/src/geo/transform.ts +11 -32
  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_fill.test.ts +1 -1
  28. package/src/render/draw_symbol.test.ts +3 -3
  29. package/src/render/image_atlas.ts +1 -0
  30. package/src/render/line_atlas.ts +1 -0
  31. package/src/render/painter.ts +1 -1
  32. package/src/render/program.ts +1 -1
  33. package/src/render/render_to_texture.ts +31 -14
  34. package/src/render/terrain.test.ts +17 -0
  35. package/src/render/terrain.ts +34 -2
  36. package/src/render/texture.ts +1 -0
  37. package/src/render/uniform_binding.ts +2 -0
  38. package/src/render/vertex_array_object.ts +1 -0
  39. package/src/shaders/symbol_sdf.fragment.glsl +9 -3
  40. package/src/shaders/symbol_sdf.fragment.glsl.g.ts +1 -1
  41. package/src/source/canvas_source.ts +1 -3
  42. package/src/source/geojson_source.ts +1 -3
  43. package/src/source/image_source.ts +2 -4
  44. package/src/source/raster_dem_tile_source.test.ts +14 -0
  45. package/src/source/raster_dem_tile_source.ts +0 -11
  46. package/src/source/raster_tile_source.test.ts +13 -0
  47. package/src/source/source_cache.ts +1 -0
  48. package/src/source/source_state.ts +1 -0
  49. package/src/source/terrain_source_cache.ts +1 -0
  50. package/src/source/tile.ts +1 -0
  51. package/src/source/tile_cache.ts +1 -1
  52. package/src/source/tile_id.ts +1 -0
  53. package/src/source/vector_tile_worker_source.test.ts +116 -67
  54. package/src/source/vector_tile_worker_source.ts +30 -16
  55. package/src/source/worker_source.ts +1 -0
  56. package/src/source/worker_tile.test.ts +143 -0
  57. package/src/source/worker_tile.ts +26 -7
  58. package/src/style/evaluation_parameters.ts +1 -0
  59. package/src/style/properties.ts +14 -0
  60. package/src/style/style.ts +1 -0
  61. package/src/style/style_glyph.ts +1 -0
  62. package/src/symbol/collision_index.ts +1 -0
  63. package/src/symbol/grid_index.ts +1 -0
  64. package/src/ui/camera.test.ts +12 -9
  65. package/src/ui/camera.ts +77 -95
  66. package/src/ui/handler/box_zoom.ts +1 -3
  67. package/src/ui/handler/click_zoom.ts +1 -3
  68. package/src/ui/handler/keyboard.ts +1 -3
  69. package/src/ui/handler/scroll_zoom.ts +1 -3
  70. package/src/ui/handler/shim/dblclick_zoom.ts +1 -3
  71. package/src/ui/handler/shim/drag_pan.ts +1 -3
  72. package/src/ui/handler/shim/drag_rotate.ts +1 -3
  73. package/src/ui/handler/shim/two_fingers_touch.ts +1 -3
  74. package/src/ui/handler/transform-provider.ts +1 -0
  75. package/src/ui/handler/two_fingers_touch.ts +1 -3
  76. package/src/ui/handler_manager.ts +2 -2
  77. package/src/ui/hash.ts +1 -2
  78. package/src/ui/map.test.ts +17 -12
  79. package/src/ui/map.ts +132 -44
  80. package/src/ui/map_events.test.ts +76 -0
  81. package/src/ui/marker.test.ts +1 -1
  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
@@ -1,4 +1,4 @@
1
- /* MapLibre GL JS is licensed under the 3-Clause BSD License. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v3.2.0/LICENSE.txt */
1
+ /* MapLibre GL JS is licensed under the 3-Clause BSD License. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v3.2.2/LICENSE.txt */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -50,10 +50,7 @@ function getAugmentedNamespace(n) {
50
50
  if (typeof f == "function") {
51
51
  var a = function a () {
52
52
  if (this instanceof a) {
53
- var args = [null];
54
- args.push.apply(args, arguments);
55
- var Ctor = Function.bind.apply(f, args);
56
- return new Ctor();
53
+ return Reflect.construct(f, arguments, this.constructor);
57
54
  }
58
55
  return f.apply(this, arguments);
59
56
  };
@@ -1034,6 +1031,7 @@ function makeFetchRequest(requestParameters, callback) {
1034
1031
  body: requestParameters.body,
1035
1032
  credentials: requestParameters.credentials,
1036
1033
  headers: requestParameters.headers,
1034
+ cache: requestParameters.cache,
1037
1035
  referrer: getReferrer(),
1038
1036
  signal: controller.signal
1039
1037
  });
@@ -5077,7 +5075,7 @@ function hslToRgb([h, s, l, alpha]) {
5077
5075
  * or `undefined` if the input is not a valid color string.
5078
5076
  */
5079
5077
  function parseCssColor(input) {
5080
- input = input.toLowerCase();
5078
+ input = input.toLowerCase().trim();
5081
5079
  if (input === 'transparent') {
5082
5080
  return [0, 0, 0, 0];
5083
5081
  }
@@ -9002,7 +9000,7 @@ const filterSpec = {
9002
9000
  * passes its test.
9003
9001
  *
9004
9002
  * @private
9005
- * @param {Array} filter maplibre gl filter
9003
+ * @param {Array} filter MapLibre filter
9006
9004
  * @returns {Function} filter-evaluating function
9007
9005
  */
9008
9006
  function createFilter(filter) {
@@ -10723,7 +10721,7 @@ function validateGlyphsUrl(options) {
10723
10721
  }
10724
10722
 
10725
10723
  /**
10726
- * Validate a MapLibre GL style against the style specification. This entrypoint,
10724
+ * Validate a MapLibre style against the style specification. This entrypoint,
10727
10725
  * `maplibre-gl-style-spec/lib/validate_style.min`, is designed to produce as
10728
10726
  * small a browserify bundle as possible by omitting unnecessary functionality
10729
10727
  * and legacy style specifications.
@@ -12002,6 +12000,7 @@ const lazyLoadRTLTextPlugin = function () {
12002
12000
  };
12003
12001
 
12004
12002
  /**
12003
+ * @internal
12005
12004
  * A parameter that can be evaluated to a value
12006
12005
  */
12007
12006
  class EvaluationParameters {
@@ -12043,6 +12042,7 @@ class EvaluationParameters {
12043
12042
  }
12044
12043
 
12045
12044
  /**
12045
+ * @internal
12046
12046
  * `PropertyValue` represents the value part of a property key-value unit. It's used to represent both
12047
12047
  * paint and layout property values, and regardless of whether or not their property supports data-driven
12048
12048
  * expressions.
@@ -12073,6 +12073,7 @@ class PropertyValue {
12073
12073
  }
12074
12074
  }
12075
12075
  /**
12076
+ * @internal
12076
12077
  * Paint properties are _transitionable_: they can change in a fluid manner, interpolating or cross-fading between
12077
12078
  * old and new value. The duration of the transition, and the delay before it begins, is configurable.
12078
12079
  *
@@ -12095,6 +12096,7 @@ class TransitionablePropertyValue {
12095
12096
  }
12096
12097
  }
12097
12098
  /**
12099
+ * @internal
12098
12100
  * `Transitionable` stores a map of all (property name, `TransitionablePropertyValue`) pairs for paint properties of a
12099
12101
  * given layer type. It can calculate the `TransitioningPropertyValue`s for all of them at once, producing a
12100
12102
  * `Transitioning` instance for the same set of properties.
@@ -12154,6 +12156,7 @@ class Transitionable {
12154
12156
  }
12155
12157
  }
12156
12158
  /**
12159
+ * @internal
12157
12160
  * `TransitioningPropertyValue` implements the first of two intermediate steps in the evaluation chain of a paint
12158
12161
  * property value. In this step, transitions between old and new values are handled: as long as the transition is in
12159
12162
  * progress, `TransitioningPropertyValue` maintains a reference to the prior value, and interpolates between it and
@@ -12202,6 +12205,7 @@ class TransitioningPropertyValue {
12202
12205
  }
12203
12206
  }
12204
12207
  /**
12208
+ * @internal
12205
12209
  * `Transitioning` stores a map of all (property name, `TransitioningPropertyValue`) pairs for paint properties of a
12206
12210
  * given layer type. It can calculate the possibly-evaluated values for all of them at once, producing a
12207
12211
  * `PossiblyEvaluated` instance for the same set of properties.
@@ -12267,6 +12271,7 @@ class Layout {
12267
12271
  }
12268
12272
  }
12269
12273
  /**
12274
+ * @internal
12270
12275
  * `PossiblyEvaluatedPropertyValue` is used for data-driven paint and layout property values. It holds a
12271
12276
  * `PossiblyEvaluatedValue` and the `GlobalProperties` that were used to generate it. You're not allowed to supply
12272
12277
  * a different set of `GlobalProperties` when performing the final evaluation because they would be ignored in the
@@ -12294,6 +12299,7 @@ class PossiblyEvaluatedPropertyValue {
12294
12299
  }
12295
12300
  }
12296
12301
  /**
12302
+ * @internal
12297
12303
  * `PossiblyEvaluated` stores a map of all (property name, `R`) pairs for paint or layout properties of a
12298
12304
  * given layer type.
12299
12305
  */
@@ -12307,6 +12313,7 @@ class PossiblyEvaluated {
12307
12313
  }
12308
12314
  }
12309
12315
  /**
12316
+ * @internal
12310
12317
  * An implementation of `Property` for properties that do not permit data-driven (source or composite) expressions.
12311
12318
  * This restriction allows us to declare statically that the result of possibly evaluating this kind of property
12312
12319
  * is in fact always the scalar type `T`, and can be used without further evaluating the value on a per-feature basis.
@@ -12332,6 +12339,7 @@ class DataConstantProperty {
12332
12339
  }
12333
12340
  }
12334
12341
  /**
12342
+ * @internal
12335
12343
  * An implementation of `Property` for properties that permit data-driven (source or composite) expressions.
12336
12344
  * The result of possibly evaluating this kind of property is `PossiblyEvaluatedPropertyValue<T>`; obtaining
12337
12345
  * a scalar value `T` requires further evaluation on a per-feature basis.
@@ -12384,6 +12392,7 @@ class DataDrivenProperty {
12384
12392
  }
12385
12393
  }
12386
12394
  /**
12395
+ * @internal
12387
12396
  * An implementation of `Property` for data driven `line-pattern` which are transitioned by cross-fading
12388
12397
  * rather than interpolation.
12389
12398
  */
@@ -12429,6 +12438,7 @@ class CrossFadedDataDrivenProperty extends DataDrivenProperty {
12429
12438
  }
12430
12439
  }
12431
12440
  /**
12441
+ * @internal
12432
12442
  * An implementation of `Property` for `*-pattern` and `line-dasharray`, which are transitioned by cross-fading
12433
12443
  * rather than interpolation.
12434
12444
  */
@@ -12457,6 +12467,7 @@ class CrossFadedProperty {
12457
12467
  }
12458
12468
  }
12459
12469
  /**
12470
+ * @internal
12460
12471
  * An implementation of `Property` for `heatmap-color` and `line-gradient`. Interpolation is a no-op, and
12461
12472
  * evaluation returns a boolean value in order to indicate its presence, but the real
12462
12473
  * evaluation happens in StyleLayer classes.
@@ -12471,6 +12482,7 @@ class ColorRampProperty {
12471
12482
  interpolate() { return false; }
12472
12483
  }
12473
12484
  /**
12485
+ * @internal
12474
12486
  * `Properties` holds objects containing default values for the layout or paint property set of a given
12475
12487
  * layer type. These objects are immutable, and they are used as the prototypes for the `_values` members of
12476
12488
  * `Transitionable`, `Transitioning`, `Layout`, and `PossiblyEvaluated`. This allows these classes to avoid
@@ -12698,6 +12710,7 @@ class StyleLayer extends Evented {
12698
12710
 
12699
12711
  // Note: all "sizes" are measured in bytes
12700
12712
  /**
12713
+ * @internal
12701
12714
  * A view type size
12702
12715
  */
12703
12716
  const viewTypes = {
@@ -12709,7 +12722,7 @@ const viewTypes = {
12709
12722
  'Uint32': Uint32Array,
12710
12723
  'Float32': Float32Array
12711
12724
  };
12712
- /** */
12725
+ /** @internal */
12713
12726
  class Struct {
12714
12727
  /**
12715
12728
  * @param structArray - The StructArray the struct is stored in
@@ -12726,6 +12739,7 @@ class Struct {
12726
12739
  const DEFAULT_CAPACITY = 128;
12727
12740
  const RESIZE_MULTIPLIER = 5;
12728
12741
  /**
12742
+ * @internal
12729
12743
  * `StructArray` provides an abstraction over `ArrayBuffer` and `TypedArray`
12730
12744
  * making it behave like an array of typed structs.
12731
12745
  *
@@ -12860,6 +12874,7 @@ function align$1(offset, size) {
12860
12874
 
12861
12875
  // This file is generated. Edit build/generate-struct-arrays.ts, then run `npm run codegen`.
12862
12876
  /**
12877
+ * @internal
12863
12878
  * Implementation of the StructArray layout:
12864
12879
  * [0]: Int16[2]
12865
12880
  *
@@ -12884,6 +12899,7 @@ class StructArrayLayout2i4 extends StructArray {
12884
12899
  StructArrayLayout2i4.prototype.bytesPerElement = 4;
12885
12900
  register('StructArrayLayout2i4', StructArrayLayout2i4);
12886
12901
  /**
12902
+ * @internal
12887
12903
  * Implementation of the StructArray layout:
12888
12904
  * [0]: Int16[3]
12889
12905
  *
@@ -12909,6 +12925,7 @@ class StructArrayLayout3i6 extends StructArray {
12909
12925
  StructArrayLayout3i6.prototype.bytesPerElement = 6;
12910
12926
  register('StructArrayLayout3i6', StructArrayLayout3i6);
12911
12927
  /**
12928
+ * @internal
12912
12929
  * Implementation of the StructArray layout:
12913
12930
  * [0]: Int16[4]
12914
12931
  *
@@ -12935,6 +12952,7 @@ class StructArrayLayout4i8 extends StructArray {
12935
12952
  StructArrayLayout4i8.prototype.bytesPerElement = 8;
12936
12953
  register('StructArrayLayout4i8', StructArrayLayout4i8);
12937
12954
  /**
12955
+ * @internal
12938
12956
  * Implementation of the StructArray layout:
12939
12957
  * [0]: Int16[2]
12940
12958
  * [4]: Int16[4]
@@ -12964,6 +12982,7 @@ class StructArrayLayout2i4i12 extends StructArray {
12964
12982
  StructArrayLayout2i4i12.prototype.bytesPerElement = 12;
12965
12983
  register('StructArrayLayout2i4i12', StructArrayLayout2i4i12);
12966
12984
  /**
12985
+ * @internal
12967
12986
  * Implementation of the StructArray layout:
12968
12987
  * [0]: Int16[2]
12969
12988
  * [4]: Uint8[4]
@@ -12994,6 +13013,7 @@ class StructArrayLayout2i4ub8 extends StructArray {
12994
13013
  StructArrayLayout2i4ub8.prototype.bytesPerElement = 8;
12995
13014
  register('StructArrayLayout2i4ub8', StructArrayLayout2i4ub8);
12996
13015
  /**
13016
+ * @internal
12997
13017
  * Implementation of the StructArray layout:
12998
13018
  * [0]: Float32[2]
12999
13019
  *
@@ -13018,6 +13038,7 @@ class StructArrayLayout2f8 extends StructArray {
13018
13038
  StructArrayLayout2f8.prototype.bytesPerElement = 8;
13019
13039
  register('StructArrayLayout2f8', StructArrayLayout2f8);
13020
13040
  /**
13041
+ * @internal
13021
13042
  * Implementation of the StructArray layout:
13022
13043
  * [0]: Uint16[10]
13023
13044
  *
@@ -13050,6 +13071,7 @@ class StructArrayLayout10ui20 extends StructArray {
13050
13071
  StructArrayLayout10ui20.prototype.bytesPerElement = 20;
13051
13072
  register('StructArrayLayout10ui20', StructArrayLayout10ui20);
13052
13073
  /**
13074
+ * @internal
13053
13075
  * Implementation of the StructArray layout:
13054
13076
  * [0]: Int16[4]
13055
13077
  * [8]: Uint16[4]
@@ -13087,6 +13109,7 @@ class StructArrayLayout4i4ui4i24 extends StructArray {
13087
13109
  StructArrayLayout4i4ui4i24.prototype.bytesPerElement = 24;
13088
13110
  register('StructArrayLayout4i4ui4i24', StructArrayLayout4i4ui4i24);
13089
13111
  /**
13112
+ * @internal
13090
13113
  * Implementation of the StructArray layout:
13091
13114
  * [0]: Float32[3]
13092
13115
  *
@@ -13112,6 +13135,7 @@ class StructArrayLayout3f12 extends StructArray {
13112
13135
  StructArrayLayout3f12.prototype.bytesPerElement = 12;
13113
13136
  register('StructArrayLayout3f12', StructArrayLayout3f12);
13114
13137
  /**
13138
+ * @internal
13115
13139
  * Implementation of the StructArray layout:
13116
13140
  * [0]: Uint32[1]
13117
13141
  *
@@ -13135,6 +13159,7 @@ class StructArrayLayout1ul4 extends StructArray {
13135
13159
  StructArrayLayout1ul4.prototype.bytesPerElement = 4;
13136
13160
  register('StructArrayLayout1ul4', StructArrayLayout1ul4);
13137
13161
  /**
13162
+ * @internal
13138
13163
  * Implementation of the StructArray layout:
13139
13164
  * [0]: Int16[6]
13140
13165
  * [12]: Uint32[1]
@@ -13171,6 +13196,7 @@ class StructArrayLayout6i1ul2ui20 extends StructArray {
13171
13196
  StructArrayLayout6i1ul2ui20.prototype.bytesPerElement = 20;
13172
13197
  register('StructArrayLayout6i1ul2ui20', StructArrayLayout6i1ul2ui20);
13173
13198
  /**
13199
+ * @internal
13174
13200
  * Implementation of the StructArray layout:
13175
13201
  * [0]: Int16[2]
13176
13202
  * [4]: Int16[2]
@@ -13201,6 +13227,7 @@ class StructArrayLayout2i2i2i12 extends StructArray {
13201
13227
  StructArrayLayout2i2i2i12.prototype.bytesPerElement = 12;
13202
13228
  register('StructArrayLayout2i2i2i12', StructArrayLayout2i2i2i12);
13203
13229
  /**
13230
+ * @internal
13204
13231
  * Implementation of the StructArray layout:
13205
13232
  * [0]: Float32[2]
13206
13233
  * [8]: Float32[1]
@@ -13232,6 +13259,7 @@ class StructArrayLayout2f1f2i16 extends StructArray {
13232
13259
  StructArrayLayout2f1f2i16.prototype.bytesPerElement = 16;
13233
13260
  register('StructArrayLayout2f1f2i16', StructArrayLayout2f1f2i16);
13234
13261
  /**
13262
+ * @internal
13235
13263
  * Implementation of the StructArray layout:
13236
13264
  * [0]: Uint8[2]
13237
13265
  * [4]: Float32[2]
@@ -13260,6 +13288,7 @@ class StructArrayLayout2ub2f12 extends StructArray {
13260
13288
  StructArrayLayout2ub2f12.prototype.bytesPerElement = 12;
13261
13289
  register('StructArrayLayout2ub2f12', StructArrayLayout2ub2f12);
13262
13290
  /**
13291
+ * @internal
13263
13292
  * Implementation of the StructArray layout:
13264
13293
  * [0]: Uint16[3]
13265
13294
  *
@@ -13285,6 +13314,7 @@ class StructArrayLayout3ui6 extends StructArray {
13285
13314
  StructArrayLayout3ui6.prototype.bytesPerElement = 6;
13286
13315
  register('StructArrayLayout3ui6', StructArrayLayout3ui6);
13287
13316
  /**
13317
+ * @internal
13288
13318
  * Implementation of the StructArray layout:
13289
13319
  * [0]: Int16[2]
13290
13320
  * [4]: Uint16[2]
@@ -13336,6 +13366,7 @@ class StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48 extends StructArray {
13336
13366
  StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48.prototype.bytesPerElement = 48;
13337
13367
  register('StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48', StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48);
13338
13368
  /**
13369
+ * @internal
13339
13370
  * Implementation of the StructArray layout:
13340
13371
  * [0]: Int16[8]
13341
13372
  * [16]: Uint16[15]
@@ -13393,6 +13424,7 @@ class StructArrayLayout8i15ui1ul4f68 extends StructArray {
13393
13424
  StructArrayLayout8i15ui1ul4f68.prototype.bytesPerElement = 68;
13394
13425
  register('StructArrayLayout8i15ui1ul4f68', StructArrayLayout8i15ui1ul4f68);
13395
13426
  /**
13427
+ * @internal
13396
13428
  * Implementation of the StructArray layout:
13397
13429
  * [0]: Float32[1]
13398
13430
  *
@@ -13416,6 +13448,7 @@ class StructArrayLayout1f4 extends StructArray {
13416
13448
  StructArrayLayout1f4.prototype.bytesPerElement = 4;
13417
13449
  register('StructArrayLayout1f4', StructArrayLayout1f4);
13418
13450
  /**
13451
+ * @internal
13419
13452
  * Implementation of the StructArray layout:
13420
13453
  * [0]: Uint32[1]
13421
13454
  * [4]: Uint16[2]
@@ -13444,6 +13477,7 @@ class StructArrayLayout1ul2ui8 extends StructArray {
13444
13477
  StructArrayLayout1ul2ui8.prototype.bytesPerElement = 8;
13445
13478
  register('StructArrayLayout1ul2ui8', StructArrayLayout1ul2ui8);
13446
13479
  /**
13480
+ * @internal
13447
13481
  * Implementation of the StructArray layout:
13448
13482
  * [0]: Uint16[2]
13449
13483
  *
@@ -13468,6 +13502,7 @@ class StructArrayLayout2ui4 extends StructArray {
13468
13502
  StructArrayLayout2ui4.prototype.bytesPerElement = 4;
13469
13503
  register('StructArrayLayout2ui4', StructArrayLayout2ui4);
13470
13504
  /**
13505
+ * @internal
13471
13506
  * Implementation of the StructArray layout:
13472
13507
  * [0]: Uint16[1]
13473
13508
  *
@@ -13491,6 +13526,7 @@ class StructArrayLayout1ui2 extends StructArray {
13491
13526
  StructArrayLayout1ui2.prototype.bytesPerElement = 2;
13492
13527
  register('StructArrayLayout1ui2', StructArrayLayout1ui2);
13493
13528
  /**
13529
+ * @internal
13494
13530
  * Implementation of the StructArray layout:
13495
13531
  * [0]: Float32[4]
13496
13532
  *
@@ -13516,7 +13552,7 @@ class StructArrayLayout4f16 extends StructArray {
13516
13552
  }
13517
13553
  StructArrayLayout4f16.prototype.bytesPerElement = 16;
13518
13554
  register('StructArrayLayout4f16', StructArrayLayout4f16);
13519
- /** */
13555
+ /** @internal */
13520
13556
  class CollisionBoxStruct extends Struct {
13521
13557
  get anchorPointX() { return this._structArray.int16[this._pos2 + 0]; }
13522
13558
  get anchorPointY() { return this._structArray.int16[this._pos2 + 1]; }
@@ -13530,7 +13566,7 @@ class CollisionBoxStruct extends Struct {
13530
13566
  get anchorPoint() { return new Point$2(this.anchorPointX, this.anchorPointY); }
13531
13567
  }
13532
13568
  CollisionBoxStruct.prototype.size = 20;
13533
- /** */
13569
+ /** @internal */
13534
13570
  class CollisionBoxArray extends StructArrayLayout6i1ul2ui20 {
13535
13571
  /**
13536
13572
  * Return the CollisionBoxStruct at the given location in the array.
@@ -13541,7 +13577,7 @@ class CollisionBoxArray extends StructArrayLayout6i1ul2ui20 {
13541
13577
  }
13542
13578
  }
13543
13579
  register('CollisionBoxArray', CollisionBoxArray);
13544
- /** */
13580
+ /** @internal */
13545
13581
  class PlacedSymbolStruct extends Struct {
13546
13582
  get anchorX() { return this._structArray.int16[this._pos2 + 0]; }
13547
13583
  get anchorY() { return this._structArray.int16[this._pos2 + 1]; }
@@ -13565,7 +13601,7 @@ class PlacedSymbolStruct extends Struct {
13565
13601
  get associatedIconIndex() { return this._structArray.int16[this._pos2 + 22]; }
13566
13602
  }
13567
13603
  PlacedSymbolStruct.prototype.size = 48;
13568
- /** */
13604
+ /** @internal */
13569
13605
  class PlacedSymbolArray extends StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48 {
13570
13606
  /**
13571
13607
  * Return the PlacedSymbolStruct at the given location in the array.
@@ -13576,7 +13612,7 @@ class PlacedSymbolArray extends StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48 {
13576
13612
  }
13577
13613
  }
13578
13614
  register('PlacedSymbolArray', PlacedSymbolArray);
13579
- /** */
13615
+ /** @internal */
13580
13616
  class SymbolInstanceStruct extends Struct {
13581
13617
  get anchorX() { return this._structArray.int16[this._pos2 + 0]; }
13582
13618
  get anchorY() { return this._structArray.int16[this._pos2 + 1]; }
@@ -13609,7 +13645,7 @@ class SymbolInstanceStruct extends Struct {
13609
13645
  get collisionCircleDiameter() { return this._structArray.float32[this._pos4 + 16]; }
13610
13646
  }
13611
13647
  SymbolInstanceStruct.prototype.size = 68;
13612
- /** */
13648
+ /** @internal */
13613
13649
  class SymbolInstanceArray extends StructArrayLayout8i15ui1ul4f68 {
13614
13650
  /**
13615
13651
  * Return the SymbolInstanceStruct at the given location in the array.
@@ -13620,26 +13656,26 @@ class SymbolInstanceArray extends StructArrayLayout8i15ui1ul4f68 {
13620
13656
  }
13621
13657
  }
13622
13658
  register('SymbolInstanceArray', SymbolInstanceArray);
13623
- /** */
13659
+ /** @internal */
13624
13660
  class GlyphOffsetArray extends StructArrayLayout1f4 {
13625
13661
  getoffsetX(index) { return this.float32[index * 1 + 0]; }
13626
13662
  }
13627
13663
  register('GlyphOffsetArray', GlyphOffsetArray);
13628
- /** */
13664
+ /** @internal */
13629
13665
  class SymbolLineVertexArray extends StructArrayLayout3i6 {
13630
13666
  getx(index) { return this.int16[index * 3 + 0]; }
13631
13667
  gety(index) { return this.int16[index * 3 + 1]; }
13632
13668
  gettileUnitDistanceFromAnchor(index) { return this.int16[index * 3 + 2]; }
13633
13669
  }
13634
13670
  register('SymbolLineVertexArray', SymbolLineVertexArray);
13635
- /** */
13671
+ /** @internal */
13636
13672
  class FeatureIndexStruct extends Struct {
13637
13673
  get featureIndex() { return this._structArray.uint32[this._pos4 + 0]; }
13638
13674
  get sourceLayerIndex() { return this._structArray.uint16[this._pos2 + 2]; }
13639
13675
  get bucketIndex() { return this._structArray.uint16[this._pos2 + 3]; }
13640
13676
  }
13641
13677
  FeatureIndexStruct.prototype.size = 8;
13642
- /** */
13678
+ /** @internal */
13643
13679
  class FeatureIndexArray extends StructArrayLayout1ul2ui8 {
13644
13680
  /**
13645
13681
  * Return the FeatureIndexStruct at the given location in the array.
@@ -13697,6 +13733,7 @@ const layout$6 = createLayout([
13697
13733
  const { members: members$4, size: size$4, alignment: alignment$4 } = layout$6;
13698
13734
 
13699
13735
  /**
13736
+ * @internal
13700
13737
  * Used for calculations on vector segments
13701
13738
  */
13702
13739
  class SegmentVector {
@@ -14025,6 +14062,7 @@ function swap$2(arr, i, j) {
14025
14062
  register('FeaturePositionMap', FeaturePositionMap);
14026
14063
 
14027
14064
  /**
14065
+ * @internal
14028
14066
  * A base uniform abstract class
14029
14067
  */
14030
14068
  class Uniform {
@@ -14351,6 +14389,7 @@ class CrossFadedCompositeBinder {
14351
14389
  }
14352
14390
  }
14353
14391
  /**
14392
+ * @internal
14354
14393
  * ProgramConfiguration contains the logic for binding style layer properties and tile
14355
14394
  * layer feature data into GL program uniforms and vertex attributes.
14356
14395
  *
@@ -14706,6 +14745,7 @@ function addCircleVertex(layoutVertexArray, x, y, extrudeX, extrudeY) {
14706
14745
  layoutVertexArray.emplaceBack((x * 2) + ((extrudeX + 1) / 2), (y * 2) + ((extrudeY + 1) / 2));
14707
14746
  }
14708
14747
  /**
14748
+ * @internal
14709
14749
  * Circles are represented by two triangles.
14710
14750
  *
14711
14751
  * Each corner has a pos that is the center of the circle and an extrusion
@@ -22875,6 +22915,7 @@ function copyImage(srcImg, dstImg, srcPt, dstPt, size, channels) {
22875
22915
  return dstImg;
22876
22916
  }
22877
22917
  /**
22918
+ * @internal
22878
22919
  * An image with alpha color value
22879
22920
  */
22880
22921
  class AlphaImage {
@@ -24792,6 +24833,7 @@ const LINE_DISTANCE_SCALE = 1 / 2;
24792
24833
  // The maximum line distance, in tile units, that fits in the buffer.
24793
24834
  const MAX_LINE_DISTANCE = Math.pow(2, LINE_DISTANCE_BUFFER_BITS - 1) / LINE_DISTANCE_SCALE;
24794
24835
  /**
24836
+ * @internal
24795
24837
  * Line bucket class
24796
24838
  */
24797
24839
  class LineBucket {
@@ -26495,6 +26537,7 @@ class ImagePosition {
26495
26537
  }
26496
26538
  }
26497
26539
  /**
26540
+ * @internal
26498
26541
  * A class holding all the images
26499
26542
  */
26500
26543
  class ImageAtlas {
@@ -27320,6 +27363,7 @@ class CollisionBuffers {
27320
27363
  }
27321
27364
  register('CollisionBuffers', CollisionBuffers);
27322
27365
  /**
27366
+ * @internal
27323
27367
  * Unlike other buckets, which simply implement #addFeature with type-specific
27324
27368
  * logic for (essentially) triangulating feature geometries, SymbolBucket
27325
27369
  * requires specialized behavior:
@@ -28791,6 +28835,7 @@ class CanonicalTileID {
28791
28835
  }
28792
28836
  }
28793
28837
  /**
28838
+ * @internal
28794
28839
  * An unwrapped tile identifier
28795
28840
  */
28796
28841
  class UnwrappedTileID {
@@ -29093,6 +29138,7 @@ class GeoJSONFeature {
29093
29138
  }
29094
29139
 
29095
29140
  /**
29141
+ * @internal
29096
29142
  * An in memory index class to allow fast interaction with features
29097
29143
  */
29098
29144
  class FeatureIndex {
@@ -30896,9 +30942,8 @@ const PerformanceUtils = {
30896
30942
  }
30897
30943
  };
30898
30944
  /**
30945
+ * @internal
30899
30946
  * Safe wrapper for the performance resource timing API in web workers with graceful degradation
30900
- *
30901
- * @hidden
30902
30947
  */
30903
30948
  class RequestPerformance {
30904
30949
  constructor(request) {
@@ -31195,6 +31240,8 @@ class WorkerTile {
31195
31240
  this.collectResourceTiming = !!params.collectResourceTiming;
31196
31241
  this.returnDependencies = !!params.returnDependencies;
31197
31242
  this.promoteId = params.promoteId;
31243
+ this.inFlightDependencies = [];
31244
+ this.dependencySentinel = -1;
31198
31245
  }
31199
31246
  parse(data, layerIndex, availableImages, actor, callback) {
31200
31247
  this.status = 'parsing';
@@ -31259,40 +31306,53 @@ class WorkerTile {
31259
31306
  let iconMap;
31260
31307
  let patternMap;
31261
31308
  const stacks = performance.mapObject(options.glyphDependencies, (glyphs) => Object.keys(glyphs).map(Number));
31309
+ this.inFlightDependencies.forEach((request) => request === null || request === void 0 ? void 0 : request.cancel());
31310
+ this.inFlightDependencies = [];
31311
+ // cancelling seems to be not sufficient, we seems to still manage to get a callback hit, so use a sentinel to drop stale results
31312
+ const dependencySentinel = ++this.dependencySentinel;
31262
31313
  if (Object.keys(stacks).length) {
31263
- actor.send('getGlyphs', { uid: this.uid, stacks, source: this.source, tileID: this.tileID, type: 'glyphs' }, (err, result) => {
31314
+ this.inFlightDependencies.push(actor.send('getGlyphs', { uid: this.uid, stacks, source: this.source, tileID: this.tileID, type: 'glyphs' }, (err, result) => {
31315
+ if (dependencySentinel !== this.dependencySentinel) {
31316
+ return;
31317
+ }
31264
31318
  if (!error) {
31265
31319
  error = err;
31266
31320
  glyphMap = result;
31267
31321
  maybePrepare.call(this);
31268
31322
  }
31269
- });
31323
+ }));
31270
31324
  }
31271
31325
  else {
31272
31326
  glyphMap = {};
31273
31327
  }
31274
31328
  const icons = Object.keys(options.iconDependencies);
31275
31329
  if (icons.length) {
31276
- actor.send('getImages', { icons, source: this.source, tileID: this.tileID, type: 'icons' }, (err, result) => {
31330
+ this.inFlightDependencies.push(actor.send('getImages', { icons, source: this.source, tileID: this.tileID, type: 'icons' }, (err, result) => {
31331
+ if (dependencySentinel !== this.dependencySentinel) {
31332
+ return;
31333
+ }
31277
31334
  if (!error) {
31278
31335
  error = err;
31279
31336
  iconMap = result;
31280
31337
  maybePrepare.call(this);
31281
31338
  }
31282
- });
31339
+ }));
31283
31340
  }
31284
31341
  else {
31285
31342
  iconMap = {};
31286
31343
  }
31287
31344
  const patterns = Object.keys(options.patternDependencies);
31288
31345
  if (patterns.length) {
31289
- actor.send('getImages', { icons: patterns, source: this.source, tileID: this.tileID, type: 'patterns' }, (err, result) => {
31346
+ this.inFlightDependencies.push(actor.send('getImages', { icons: patterns, source: this.source, tileID: this.tileID, type: 'patterns' }, (err, result) => {
31347
+ if (dependencySentinel !== this.dependencySentinel) {
31348
+ return;
31349
+ }
31290
31350
  if (!error) {
31291
31351
  error = err;
31292
31352
  patternMap = result;
31293
31353
  maybePrepare.call(this);
31294
31354
  }
31295
- });
31355
+ }));
31296
31356
  }
31297
31357
  else {
31298
31358
  patternMap = {};
@@ -31392,6 +31452,7 @@ class VectorTileWorkerSource {
31392
31452
  this.layerIndex = layerIndex;
31393
31453
  this.availableImages = availableImages;
31394
31454
  this.loadVectorData = loadVectorData || loadVectorTile;
31455
+ this.fetching = {};
31395
31456
  this.loading = {};
31396
31457
  this.loaded = {};
31397
31458
  }
@@ -31430,6 +31491,7 @@ class VectorTileWorkerSource {
31430
31491
  }
31431
31492
  workerTile.vectorTile = response.vectorTile;
31432
31493
  workerTile.parse(response.vectorTile, this.layerIndex, this.availableImages, this.actor, (err, result) => {
31494
+ delete this.fetching[uid];
31433
31495
  if (err || !result)
31434
31496
  return callback(err);
31435
31497
  // Transferring a copy of rawTileData because the worker needs to retain its copy.
@@ -31437,34 +31499,43 @@ class VectorTileWorkerSource {
31437
31499
  });
31438
31500
  this.loaded = this.loaded || {};
31439
31501
  this.loaded[uid] = workerTile;
31502
+ // keep the original fetching state so that reload tile can pick it up if the original parse is cancelled by reloads' parse
31503
+ this.fetching[uid] = { rawTileData, cacheControl, resourceTiming };
31440
31504
  });
31441
31505
  }
31442
31506
  /**
31443
31507
  * Implements {@link WorkerSource#reloadTile}.
31444
31508
  */
31445
31509
  reloadTile(params, callback) {
31446
- const loaded = this.loaded, uid = params.uid, vtSource = this;
31510
+ const loaded = this.loaded;
31511
+ const uid = params.uid;
31447
31512
  if (loaded && loaded[uid]) {
31448
31513
  const workerTile = loaded[uid];
31449
31514
  workerTile.showCollisionBoxes = params.showCollisionBoxes;
31450
- const done = (err, data) => {
31451
- const reloadCallback = workerTile.reloadCallback;
31452
- if (reloadCallback) {
31453
- delete workerTile.reloadCallback;
31454
- workerTile.parse(workerTile.vectorTile, vtSource.layerIndex, this.availableImages, vtSource.actor, reloadCallback);
31455
- }
31456
- callback(err, data);
31457
- };
31458
31515
  if (workerTile.status === 'parsing') {
31459
- workerTile.reloadCallback = done;
31516
+ workerTile.parse(workerTile.vectorTile, this.layerIndex, this.availableImages, this.actor, (err, result) => {
31517
+ if (err || !result)
31518
+ return callback(err, result);
31519
+ // if we have cancelled the original parse, make sure to pass the rawTileData from the original fetch
31520
+ let parseResult;
31521
+ if (this.fetching[uid]) {
31522
+ const { rawTileData, cacheControl, resourceTiming } = this.fetching[uid];
31523
+ delete this.fetching[uid];
31524
+ parseResult = performance.extend({ rawTileData: rawTileData.slice(0) }, result, cacheControl, resourceTiming);
31525
+ }
31526
+ else {
31527
+ parseResult = result;
31528
+ }
31529
+ callback(null, parseResult);
31530
+ });
31460
31531
  }
31461
31532
  else if (workerTile.status === 'done') {
31462
31533
  // if there was no vector tile data on the initial load, don't try and re-parse tile
31463
31534
  if (workerTile.vectorTile) {
31464
- workerTile.parse(workerTile.vectorTile, this.layerIndex, this.availableImages, this.actor, done);
31535
+ workerTile.parse(workerTile.vectorTile, this.layerIndex, this.availableImages, this.actor, callback);
31465
31536
  }
31466
31537
  else {
31467
- done();
31538
+ callback();
31468
31539
  }
31469
31540
  }
31470
31541
  }
@@ -33711,7 +33782,7 @@ define(['./shared'], (function (performance) { 'use strict';
33711
33782
 
33712
33783
  var name = "maplibre-gl";
33713
33784
  var description = "BSD licensed community fork of mapbox-gl, a WebGL interactive maps library";
33714
- var version$2 = "3.2.0";
33785
+ var version$2 = "3.2.2";
33715
33786
  var main = "dist/maplibre-gl.js";
33716
33787
  var style = "dist/maplibre-gl.css";
33717
33788
  var license = "BSD-3-Clause";
@@ -33730,11 +33801,12 @@ var dependencies = {
33730
33801
  "@mapbox/unitbezier": "^0.0.1",
33731
33802
  "@mapbox/vector-tile": "^1.3.1",
33732
33803
  "@mapbox/whoots-js": "^3.1.0",
33733
- "@maplibre/maplibre-gl-style-spec": "^19.2.1",
33804
+ "@maplibre/maplibre-gl-style-spec": "^19.2.2",
33734
33805
  "@types/geojson": "^7946.0.10",
33735
33806
  "@types/mapbox__point-geometry": "^0.1.2",
33736
33807
  "@types/mapbox__vector-tile": "^1.3.0",
33737
33808
  "@types/pbf": "^3.0.2",
33809
+ "@types/supercluster": "^7.1.0",
33738
33810
  earcut: "^2.2.4",
33739
33811
  "geojson-vt": "^3.2.1",
33740
33812
  "gl-matrix": "^3.4.3",
@@ -33751,7 +33823,7 @@ var dependencies = {
33751
33823
  var devDependencies = {
33752
33824
  "@mapbox/mapbox-gl-rtl-text": "^0.2.3",
33753
33825
  "@mapbox/mvt-fixtures": "^3.10.0",
33754
- "@rollup/plugin-commonjs": "^25.0.2",
33826
+ "@rollup/plugin-commonjs": "^25.0.3",
33755
33827
  "@rollup/plugin-json": "^6.0.0",
33756
33828
  "@rollup/plugin-node-resolve": "^15.1.0",
33757
33829
  "@rollup/plugin-replace": "^5.0.2",
@@ -33763,49 +33835,48 @@ var devDependencies = {
33763
33835
  "@types/d3": "^7.4.0",
33764
33836
  "@types/diff": "^5.0.3",
33765
33837
  "@types/earcut": "^2.1.1",
33766
- "@types/eslint": "^8.40.2",
33838
+ "@types/eslint": "^8.44.1",
33767
33839
  "@types/gl": "^6.0.2",
33768
33840
  "@types/glob": "^8.1.0",
33769
- "@types/jest": "^29.5.2",
33841
+ "@types/jest": "^29.5.3",
33770
33842
  "@types/jsdom": "^21.1.1",
33771
33843
  "@types/minimist": "^1.2.2",
33772
33844
  "@types/murmurhash-js": "^1.0.4",
33773
33845
  "@types/nise": "^1.4.1",
33774
- "@types/node": "^20.3.3",
33846
+ "@types/node": "^20.4.5",
33775
33847
  "@types/offscreencanvas": "^2019.7.0",
33776
33848
  "@types/pixelmatch": "^5.2.4",
33777
33849
  "@types/pngjs": "^6.0.1",
33778
- "@types/react": "^18.2.14",
33779
- "@types/react-dom": "^18.2.6",
33850
+ "@types/react": "^18.2.17",
33851
+ "@types/react-dom": "^18.2.7",
33780
33852
  "@types/request": "^2.48.8",
33781
33853
  "@types/shuffle-seed": "^1.1.0",
33782
- "@types/supercluster": "^7.1.0",
33783
33854
  "@types/window-or-global": "^1.0.4",
33784
- "@typescript-eslint/eslint-plugin": "^5.60.1",
33785
- "@typescript-eslint/parser": "^5.60.1",
33855
+ "@typescript-eslint/eslint-plugin": "^6.2.0",
33856
+ "@typescript-eslint/parser": "^6.2.0",
33786
33857
  address: "^1.2.2",
33787
33858
  benchmark: "^2.1.4",
33788
33859
  canvas: "^2.11.2",
33789
33860
  cssnano: "^6.0.1",
33790
33861
  d3: "^7.8.5",
33791
33862
  "d3-queue": "^3.0.7",
33792
- "devtools-protocol": "^0.0.1165014",
33863
+ "devtools-protocol": "^0.0.1173815",
33793
33864
  diff: "^5.1.0",
33794
33865
  "dts-bundle-generator": "^8.0.1",
33795
- eslint: "^8.44.0",
33866
+ eslint: "^8.46.0",
33796
33867
  "eslint-config-mourner": "^3.0.0",
33797
33868
  "eslint-plugin-html": "^7.1.0",
33798
- "eslint-plugin-import": "^2.27.5",
33799
- "eslint-plugin-jest": "^27.2.2",
33869
+ "eslint-plugin-import": "^2.28.0",
33870
+ "eslint-plugin-jest": "^27.2.3",
33871
+ "eslint-plugin-react": "^7.33.1",
33800
33872
  "eslint-plugin-tsdoc": "0.2.17",
33801
- "eslint-plugin-react": "^7.32.2",
33802
- expect: "^29.5.0",
33873
+ expect: "^29.6.2",
33803
33874
  gl: "^6.0.2",
33804
- glob: "^10.3.1",
33875
+ glob: "^10.3.3",
33805
33876
  "is-builtin-module": "^3.2.1",
33806
- jest: "^29.5.0",
33877
+ jest: "^29.6.2",
33807
33878
  "jest-canvas-mock": "^2.5.2",
33808
- "jest-environment-jsdom": "^29.5.0",
33879
+ "jest-environment-jsdom": "^29.6.2",
33809
33880
  jsdom: "^22.1.0",
33810
33881
  "json-stringify-pretty-compact": "^4.0.0",
33811
33882
  minimist: "^1.2.8",
@@ -33817,28 +33888,28 @@ var devDependencies = {
33817
33888
  "pdf-merger-js": "^4.3.0",
33818
33889
  pixelmatch: "^5.3.0",
33819
33890
  pngjs: "^7.0.0",
33820
- postcss: "^8.4.24",
33891
+ postcss: "^8.4.27",
33821
33892
  "postcss-cli": "^10.1.0",
33822
33893
  "postcss-inline-svg": "^6.0.0",
33823
- "pretty-bytes": "^6.1.0",
33824
- puppeteer: "^20.7.4",
33894
+ "pretty-bytes": "^6.1.1",
33895
+ puppeteer: "^20.9.0",
33825
33896
  react: "^18.2.0",
33826
33897
  "react-dom": "^18.2.0",
33827
- rollup: "^3.26.0",
33898
+ rollup: "^3.27.0",
33828
33899
  "rollup-plugin-sourcemaps": "^0.6.3",
33829
33900
  rw: "^1.3.3",
33830
- semver: "^7.5.3",
33901
+ semver: "^7.5.4",
33831
33902
  "shuffle-seed": "^1.1.6",
33832
33903
  "source-map-explorer": "^2.5.3",
33833
33904
  st: "^3.0.0",
33834
- stylelint: "^15.10.1",
33835
- "stylelint-config-standard": "^33.0.0",
33905
+ stylelint: "^15.10.2",
33906
+ "stylelint-config-standard": "^34.0.0",
33836
33907
  "ts-jest": "^29.1.1",
33837
33908
  "ts-node": "^10.9.1",
33838
- tslib: "^2.6.0",
33909
+ tslib: "^2.6.1",
33839
33910
  typedoc: "^0.24.8",
33840
- "typedoc-plugin-markdown": "^3.15.3",
33841
- "typedoc-plugin-missing-exports": "^2.0.0",
33911
+ "typedoc-plugin-markdown": "^3.15.4",
33912
+ "typedoc-plugin-missing-exports": "^2.0.1",
33842
33913
  typescript: "^5.1.6"
33843
33914
  };
33844
33915
  var overrides = {
@@ -34205,7 +34276,7 @@ var ImageRequest;
34205
34276
  if (err) {
34206
34277
  callback(err);
34207
34278
  }
34208
- else if (data instanceof HTMLImageElement || data instanceof ImageBitmap) {
34279
+ else if (data instanceof HTMLImageElement || performance.isImageBitmap(data)) {
34209
34280
  // User using addProtocol can directly return HTMLImageElement/ImageBitmap type
34210
34281
  // If HtmlImageElement is used to get image then response type will be HTMLImageElement
34211
34282
  callback(null, data);
@@ -34418,6 +34489,7 @@ function doOnceCompleted(callbackFunc, jsonsMap, imagesMap, err, expectedResultC
34418
34489
  }
34419
34490
 
34420
34491
  /**
34492
+ * @internal
34421
34493
  * A `Texture` GL related object
34422
34494
  */
34423
34495
  class Texture {
@@ -35160,6 +35232,7 @@ class Light extends performance.Evented {
35160
35232
  }
35161
35233
 
35162
35234
  /**
35235
+ * @internal
35163
35236
  * A LineAtlas lets us reuse rendered dashed lines
35164
35237
  * by writing many of them to a texture and then fetching their positions
35165
35238
  * using {@link LineAtlas#getDash}.
@@ -36069,16 +36142,6 @@ class RasterDEMTileSource extends RasterTileSource {
36069
36142
  this._options = performance.extend({ type: 'raster-dem' }, options);
36070
36143
  this.encoding = options.encoding || 'mapbox';
36071
36144
  }
36072
- serialize() {
36073
- return {
36074
- type: 'raster-dem',
36075
- url: this.url,
36076
- tileSize: this.tileSize,
36077
- tiles: this.tiles,
36078
- bounds: this.bounds,
36079
- encoding: this.encoding
36080
- };
36081
- }
36082
36145
  loadTile(tile, callback) {
36083
36146
  const url = tile.tileID.canonical.url(this.tiles, this.map.getPixelRatio(), this.scheme);
36084
36147
  tile.request = ImageRequest.getImage(this.map._requestManager.transformRequest(url, ResourceType.Tile), imageLoaded.bind(this), this.map._refreshExpiredTiles);
@@ -36224,9 +36287,7 @@ class RasterDEMTileSource extends RasterTileSource {
36224
36287
  * @see [Create and style clusters](https://maplibre.org/maplibre-gl-js/docs/examples/cluster/)
36225
36288
  */
36226
36289
  class GeoJSONSource extends performance.Evented {
36227
- /**
36228
- * @hidden
36229
- */
36290
+ /** @internal */
36230
36291
  constructor(id, options, dispatcher, eventedParent) {
36231
36292
  super();
36232
36293
  this.load = () => {
@@ -36551,9 +36612,7 @@ var rasterBoundsAttributes = performance.createLayout([
36551
36612
  * ```
36552
36613
  */
36553
36614
  class ImageSource extends performance.Evented {
36554
- /**
36555
- * @hidden
36556
- */
36615
+ /** @internal */
36557
36616
  constructor(id, options, dispatcher, eventedParent) {
36558
36617
  super();
36559
36618
  this.load = (newCoordinates, successCallback) => {
@@ -36727,7 +36786,7 @@ class ImageSource extends performance.Evented {
36727
36786
  * Given a list of coordinates, get their center as a coordinate.
36728
36787
  *
36729
36788
  * @returns centerpoint
36730
- * @hidden
36789
+ * @internal
36731
36790
  */
36732
36791
  function getCoordinatesCenterTileID(coords) {
36733
36792
  let minX = Infinity;
@@ -36948,9 +37007,7 @@ class VideoSource extends ImageSource {
36948
37007
  * ```
36949
37008
  */
36950
37009
  class CanvasSource extends ImageSource {
36951
- /**
36952
- * @hidden
36953
- */
37010
+ /** @internal */
36954
37011
  constructor(id, options, dispatcher, eventedParent) {
36955
37012
  super(id, options, dispatcher, eventedParent);
36956
37013
  this.load = () => {
@@ -37302,6 +37359,7 @@ function deserialize(input, style) {
37302
37359
 
37303
37360
  const CLOCK_SKEW_RETRY_TIMEOUT = 30000;
37304
37361
  /**
37362
+ * @internal
37305
37363
  * A tile object is the combination of a Coordinate, which defines
37306
37364
  * its place, as well as a unique ID and data tracking for its content
37307
37365
  */
@@ -37632,10 +37690,10 @@ class Tile {
37632
37690
  }
37633
37691
 
37634
37692
  /**
37693
+ * @internal
37635
37694
  * A [least-recently-used cache](http://en.wikipedia.org/wiki/Cache_algorithms)
37636
37695
  * with hash lookup made possible by keeping a list of keys in parallel to
37637
37696
  * an array of dictionary of values
37638
- *
37639
37697
  */
37640
37698
  class TileCache {
37641
37699
  /**
@@ -37813,6 +37871,7 @@ class TileCache {
37813
37871
  }
37814
37872
 
37815
37873
  /**
37874
+ * @internal
37816
37875
  * SourceFeatureState manages the state and pending changes
37817
37876
  * to features in a source, separated by source layer.
37818
37877
  * stateChanges and deletedStates batch all changes to the tile (updates and removes, respectively)
@@ -37954,6 +38013,7 @@ class SourceFeatureState {
37954
38013
  }
37955
38014
 
37956
38015
  /**
38016
+ * @internal
37957
38017
  * `SourceCache` is responsible for
37958
38018
  *
37959
38019
  * - creating an instance of `Source`
@@ -38946,6 +39006,7 @@ function overlapAllowed(overlapA, overlapB) {
38946
39006
  return allowed;
38947
39007
  }
38948
39008
  /**
39009
+ * @internal
38949
39010
  * GridIndex is a data structure for testing the intersection of
38950
39011
  * circles and rectangles in a 2d plane.
38951
39012
  * It is optimized for rapid insertion and querying.
@@ -39711,6 +39772,7 @@ function xyTransformMat4(out, a, m) {
39711
39772
  // stability, but it's expensive.
39712
39773
  const viewportPadding = 100;
39713
39774
  /**
39775
+ * @internal
39714
39776
  * A collision index used to prevent symbols from overlapping. It keep tracks of
39715
39777
  * where previous symbols have been placed and is used to check if a new
39716
39778
  * symbol overlaps with any previously added symbols.
@@ -41502,6 +41564,7 @@ class Style extends performance.Evented {
41502
41564
  }
41503
41565
  }
41504
41566
  /**
41567
+ * @internal
41505
41568
  * Apply queued style updates in a batch and recalculate zoom-dependent paint properties.
41506
41569
  */
41507
41570
  update(parameters) {
@@ -42603,7 +42666,7 @@ var symbolIconFrag = 'uniform sampler2D u_texture;varying vec2 v_tex;varying flo
42603
42666
  var symbolIconVert = 'const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}';
42604
42667
 
42605
42668
  // This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.
42606
- var symbolSDFFrag = '#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}';
42669
+ var symbolSDFFrag = '#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}';
42607
42670
 
42608
42671
  // This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.
42609
42672
  var symbolSDFVert = 'const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}';
@@ -42760,6 +42823,7 @@ uniform ${precision} ${type} u_${name};
42760
42823
  }
42761
42824
 
42762
42825
  /**
42826
+ * @internal
42763
42827
  * A vertex array object used to pass data to the webgl code
42764
42828
  */
42765
42829
  class VertexArrayObject {
@@ -42920,10 +42984,11 @@ function getTokenizedAttributesAndUniforms(array) {
42920
42984
  return result;
42921
42985
  }
42922
42986
  /**
42987
+ * @internal
42923
42988
  * A webgl program to execute in the GPU space
42924
42989
  */
42925
42990
  class Program {
42926
- constructor(context, name, source, configuration, fixedUniforms, showOverdrawInspector, terrain) {
42991
+ constructor(context, source, configuration, fixedUniforms, showOverdrawInspector, terrain) {
42927
42992
  const gl = context.gl;
42928
42993
  this.program = gl.createProgram();
42929
42994
  const staticAttrInfo = getTokenizedAttributesAndUniforms(source.staticAttributes);
@@ -43653,6 +43718,7 @@ const programUniforms = {
43653
43718
  };
43654
43719
 
43655
43720
  /**
43721
+ * @internal
43656
43722
  * an index buffer class
43657
43723
  */
43658
43724
  class IndexBuffer {
@@ -43706,6 +43772,7 @@ const AttributeType = {
43706
43772
  Float32: 'FLOAT'
43707
43773
  };
43708
43774
  /**
43775
+ * @internal
43709
43776
  * The `VertexBuffer` class turns a `StructArray` into a WebGL buffer. Each member of the StructArray's
43710
43777
  * Struct type is converted to a WebGL attribute.
43711
43778
  */
@@ -44284,6 +44351,7 @@ class DepthStencilAttachment extends FramebufferAttachment {
44284
44351
  }
44285
44352
 
44286
44353
  /**
44354
+ * @internal
44287
44355
  * A framebuffer holder object
44288
44356
  */
44289
44357
  class Framebuffer {
@@ -44334,6 +44402,7 @@ ColorMode.unblended = new ColorMode(ColorMode.Replace, performance.Color.transpa
44334
44402
  ColorMode.alphaBlended = new ColorMode([ONE, ONE_MINUS_SRC_ALPHA], performance.Color.transparent, [true, true, true, true]);
44335
44403
 
44336
44404
  /**
44405
+ * @internal
44337
44406
  * A webgl wrapper class to allow injection, mocking and abstaction
44338
44407
  */
44339
44408
  class Context {
@@ -45806,6 +45875,7 @@ function drawTerrain(painter, terrain, tiles) {
45806
45875
  }
45807
45876
 
45808
45877
  /**
45878
+ * @internal
45809
45879
  * Initialize a new painter object.
45810
45880
  */
45811
45881
  class Painter {
@@ -46198,7 +46268,7 @@ class Painter {
46198
46268
  (this._showOverdrawInspector ? '/overdraw' : '') +
46199
46269
  (this.style.map.terrain ? '/terrain' : '');
46200
46270
  if (!this.cache[key]) {
46201
- this.cache[key] = new Program(this.context, name, shaders[name], programConfiguration, programUniforms[name], this._showOverdrawInspector, this.style.map.terrain);
46271
+ this.cache[key] = new Program(this.context, shaders[name], programConfiguration, programUniforms[name], this._showOverdrawInspector, this.style.map.terrain);
46202
46272
  }
46203
46273
  return this.cache[key];
46204
46274
  }
@@ -46445,6 +46515,7 @@ class EdgeInsets {
46445
46515
  }
46446
46516
 
46447
46517
  /**
46518
+ * @internal
46448
46519
  * A single transform, generally used for a single tile to be
46449
46520
  * scaled, rotated, and zoomed.
46450
46521
  */
@@ -46452,7 +46523,6 @@ class Transform {
46452
46523
  constructor(minZoom, maxZoom, minPitch, maxPitch, renderWorldCopies) {
46453
46524
  this.tileSize = 512; // constant
46454
46525
  this.maxValidLatitude = 85.051129; // constant
46455
- this.freezeElevation = false;
46456
46526
  this._renderWorldCopies = renderWorldCopies === undefined ? true : !!renderWorldCopies;
46457
46527
  this._minZoom = minZoom || 0;
46458
46528
  this._maxZoom = maxZoom || 22;
@@ -46471,6 +46541,7 @@ class Transform {
46471
46541
  this._edgeInsets = new EdgeInsets();
46472
46542
  this._posMatrixCache = {};
46473
46543
  this._alignedPosMatrixCache = {};
46544
+ this._minEleveationForCurrentTile = 0;
46474
46545
  }
46475
46546
  clone() {
46476
46547
  const clone = new Transform(this._minZoom, this._maxZoom, this._minPitch, this.maxPitch, this._renderWorldCopies);
@@ -46484,6 +46555,7 @@ class Transform {
46484
46555
  this.height = that.height;
46485
46556
  this._center = that._center;
46486
46557
  this._elevation = that._elevation;
46558
+ this._minEleveationForCurrentTile = that._minEleveationForCurrentTile;
46487
46559
  this.zoom = that.zoom;
46488
46560
  this.angle = that.angle;
46489
46561
  this._fov = that._fov;
@@ -46795,29 +46867,6 @@ class Transform {
46795
46867
  return new performance.MercatorCoordinate(point.x / this.worldSize, point.y / this.worldSize).toLngLat();
46796
46868
  }
46797
46869
  get point() { return this.project(this.center); }
46798
- /**
46799
- * Updates the center-elevation value unless freezeElevation is activated.
46800
- * @param terrain - the terrain
46801
- */
46802
- updateElevation(terrain) {
46803
- if (this.freezeElevation)
46804
- return;
46805
- this.elevation = terrain ? this.getElevation(this._center, terrain) : 0;
46806
- }
46807
- /**
46808
- * get the elevation from terrain for the current zoomlevel.
46809
- * @param lnglat - the location
46810
- * @param terrain - the terrain
46811
- * @returns elevation in meters
46812
- */
46813
- getElevation(lnglat, terrain) {
46814
- const merc = performance.MercatorCoordinate.fromLngLat(lnglat.wrap());
46815
- const worldSize = (1 << this.tileZoom) * performance.EXTENT;
46816
- const mercX = merc.x * worldSize, mercY = merc.y * worldSize;
46817
- const tileX = Math.floor(mercX / performance.EXTENT), tileY = Math.floor(mercY / performance.EXTENT);
46818
- const tileID = new performance.OverscaledTileID(this.tileZoom, 0, this.tileZoom, tileX, tileY);
46819
- return terrain.getElevation(tileID, mercX % performance.EXTENT, mercY % performance.EXTENT, performance.EXTENT);
46820
- }
46821
46870
  /**
46822
46871
  * get the camera position in LngLat and altitudes in meter
46823
46872
  * @returns An object with lngLat & altitude.
@@ -46836,7 +46885,7 @@ class Transform {
46836
46885
  recalculateZoom(terrain) {
46837
46886
  // find position the camera is looking on
46838
46887
  const center = this.pointLocation(this.centerPoint, terrain);
46839
- const elevation = this.getElevation(center, terrain);
46888
+ const elevation = terrain.getElevationForLngLatZoom(center, this.tileZoom);
46840
46889
  const deltaElevation = this.elevation - elevation;
46841
46890
  if (!deltaElevation)
46842
46891
  return;
@@ -46871,7 +46920,7 @@ class Transform {
46871
46920
  */
46872
46921
  locationPoint(lnglat, terrain) {
46873
46922
  return terrain ?
46874
- this.coordinatePoint(this.locationCoordinate(lnglat), this.getElevation(lnglat, terrain), this.pixelMatrix3D) :
46923
+ this.coordinatePoint(this.locationCoordinate(lnglat), terrain.getElevationForLngLatZoom(lnglat, this.tileZoom), this.pixelMatrix3D) :
46875
46924
  this.coordinatePoint(this.locationCoordinate(lnglat));
46876
46925
  }
46877
46926
  /**
@@ -47091,9 +47140,11 @@ class Transform {
47091
47140
  performance.scale(m, m, [2 / this.width, 2 / this.height, 1]);
47092
47141
  this.glCoordMatrix = m;
47093
47142
  // Calculate the camera to sea-level distance in pixel in respect of terrain
47094
- // In case of negative elevation (e.g. the dead see) use the lower plane for calculation
47095
- this.cameraToSeaLevelDistance = this.cameraToCenterDistance + this._elevation * this._pixelPerMeter / Math.cos(this._pitch);
47096
- const lowestPlane = this._elevation < 0 ? this.cameraToCenterDistance : this.cameraToSeaLevelDistance;
47143
+ const cameraToSeaLevelDistance = this.cameraToCenterDistance + this._elevation * this._pixelPerMeter / Math.cos(this._pitch);
47144
+ // In case of negative minimum elevation (e.g. the dead see, under the sea maps) use a lower plane for calculation
47145
+ const minElevation = Math.min(this.elevation, this._minEleveationForCurrentTile);
47146
+ const cameraToLowestPointDistance = cameraToSeaLevelDistance - minElevation * this._pixelPerMeter / Math.cos(this._pitch);
47147
+ const lowestPlane = minElevation < 0 ? cameraToLowestPointDistance : cameraToSeaLevelDistance;
47097
47148
  // Find the distance from the center point [width/2 + offset.x, height/2 + offset.y] to the
47098
47149
  // center top point [width/2 + offset.x, 0] in Z units, using the law of sines.
47099
47150
  // 1 Z unit is equivalent to 1 horizontal px at the center of the map
@@ -47705,6 +47756,7 @@ class BlockableMapEventHandler {
47705
47756
  }
47706
47757
 
47707
47758
  /**
47759
+ * @internal
47708
47760
  * Shared utilities for the Handler classes to access the correct camera state.
47709
47761
  * If Camera.transformCameraUpdate is specified, the "desired state" of camera may differ from the state used for rendering.
47710
47762
  * The handlers need the "desired state" to track accumulated changes.
@@ -47740,9 +47792,7 @@ class TransformProvider {
47740
47792
  * @group Handlers
47741
47793
  */
47742
47794
  class BoxZoomHandler {
47743
- /**
47744
- * @hidden
47745
- */
47795
+ /** @internal */
47746
47796
  constructor(map, options) {
47747
47797
  this._map = map;
47748
47798
  this._tr = new TransformProvider(map);
@@ -48339,9 +48389,7 @@ class TouchPanHandler {
48339
48389
  * @group Handlers
48340
48390
  */
48341
48391
  class TwoFingersTouchHandler {
48342
- /**
48343
- * @hidden
48344
- */
48392
+ /** @internal */
48345
48393
  constructor() {
48346
48394
  this.reset();
48347
48395
  }
@@ -48615,9 +48663,7 @@ const defaultOptions$5 = {
48615
48663
  * @group Handlers
48616
48664
  */
48617
48665
  class KeyboardHandler {
48618
- /**
48619
- * @hidden
48620
- */
48666
+ /** @internal */
48621
48667
  constructor(map) {
48622
48668
  this._tr = new TransformProvider(map);
48623
48669
  const stepOptions = defaultOptions$5;
@@ -48795,9 +48841,7 @@ const maxScalePerFrame = 2;
48795
48841
  * @group Handlers
48796
48842
  */
48797
48843
  class ScrollZoomHandler {
48798
- /**
48799
- * @hidden
48800
- */
48844
+ /** @internal */
48801
48845
  constructor(map, triggerRenderFrame) {
48802
48846
  this._onTimeout = (initialEvent) => {
48803
48847
  this._type = 'wheel';
@@ -49061,9 +49105,7 @@ class ScrollZoomHandler {
49061
49105
  * @group Handlers
49062
49106
  */
49063
49107
  class DoubleClickZoomHandler {
49064
- /**
49065
- * @hidden
49066
- */
49108
+ /** @internal */
49067
49109
  constructor(clickZoom, TapZoom) {
49068
49110
  this._clickZoom = clickZoom;
49069
49111
  this._tapZoom = TapZoom;
@@ -49115,9 +49157,7 @@ class DoubleClickZoomHandler {
49115
49157
  * It is used by other handlers
49116
49158
  */
49117
49159
  class ClickZoomHandler {
49118
- /**
49119
- * @hidden
49120
- */
49160
+ /** @internal */
49121
49161
  constructor(map) {
49122
49162
  this._tr = new TransformProvider(map);
49123
49163
  this.reset();
@@ -49244,9 +49284,7 @@ class TapDragZoomHandler {
49244
49284
  * @group Handlers
49245
49285
  */
49246
49286
  class DragPanHandler {
49247
- /**
49248
- * @hidden
49249
- */
49287
+ /** @internal */
49250
49288
  constructor(el, mousePan, touchPan) {
49251
49289
  this._el = el;
49252
49290
  this._mousePan = mousePan;
@@ -49311,9 +49349,7 @@ class DragPanHandler {
49311
49349
  * @group Handlers
49312
49350
  */
49313
49351
  class DragRotateHandler {
49314
- /**
49315
- * @hidden
49316
- */
49352
+ /** @internal */
49317
49353
  constructor(options, mouseRotate, mousePitch) {
49318
49354
  this._pitchWithRotate = options.pitchWithRotate;
49319
49355
  this._mouseRotate = mouseRotate;
@@ -49372,9 +49408,7 @@ class DragRotateHandler {
49372
49408
  * @group Handlers
49373
49409
  */
49374
49410
  class TwoFingersTouchZoomRotateHandler {
49375
- /**
49376
- * @hidden
49377
- */
49411
+ /** @internal */
49378
49412
  constructor(el, touchZoom, touchRotate, tapDragZoom) {
49379
49413
  this._el = el;
49380
49414
  this._touchZoom = touchZoom;
@@ -49775,10 +49809,10 @@ class HandlerManager {
49775
49809
  (combinedEventsInProgress.drag || combinedEventsInProgress.zoom)) {
49776
49810
  // When starting to drag or move, flag it and register moveend to clear flagging
49777
49811
  this._terrainMovement = true;
49778
- tr.freezeElevation = true;
49812
+ this._map._elevationFreeze = true;
49779
49813
  tr.setLocationAtPoint(loc, around);
49780
49814
  this._map.once('moveend', () => {
49781
- tr.freezeElevation = false;
49815
+ this._map._elevationFreeze = false;
49782
49816
  this._terrainMovement = false;
49783
49817
  tr.recalculateZoom(map.terrain);
49784
49818
  });
@@ -49912,10 +49946,10 @@ class Camera extends performance.Evented {
49912
49946
  /**
49913
49947
  * Sets the map's geographical centerpoint. Equivalent to `jumpTo({center: center})`.
49914
49948
  *
49949
+ * Triggers the following events: `movestart` and `moveend`.
49950
+ *
49915
49951
  * @param center - The centerpoint to set.
49916
49952
  * @param eventData - Additional properties to be added to event objects of events triggered by this method.
49917
- * @event `movestart`
49918
- * @event `moveend`
49919
49953
  * @returns `this`
49920
49954
  * @example
49921
49955
  * ```ts
@@ -49928,11 +49962,11 @@ class Camera extends performance.Evented {
49928
49962
  /**
49929
49963
  * Pans the map by the specified offset.
49930
49964
  *
49965
+ * Triggers the following events: `movestart` and `moveend`.
49966
+ *
49931
49967
  * @param offset - `x` and `y` coordinates by which to pan the map.
49932
49968
  * @param options - Options object
49933
49969
  * @param eventData - Additional properties to be added to event objects of events triggered by this method.
49934
- * @event `movestart`
49935
- * @event `moveend`
49936
49970
  * @returns `this`
49937
49971
  * @see [Navigate the map with game-like controls](https://maplibre.org/maplibre-gl-js/docs/examples/game-controls/)
49938
49972
  */
@@ -49943,11 +49977,11 @@ class Camera extends performance.Evented {
49943
49977
  /**
49944
49978
  * Pans the map to the specified location with an animated transition.
49945
49979
  *
49980
+ * Triggers the following events: `movestart` and `moveend`.
49981
+ *
49946
49982
  * @param lnglat - The location to pan the map to.
49947
49983
  * @param options - Options describing the destination and animation of the transition.
49948
49984
  * @param eventData - Additional properties to be added to event objects of events triggered by this method.
49949
- * @event `movestart`
49950
- * @event `moveend`
49951
49985
  * @returns `this`
49952
49986
  * @example
49953
49987
  * ```ts
@@ -49975,14 +50009,10 @@ class Camera extends performance.Evented {
49975
50009
  /**
49976
50010
  * Sets the map's zoom level. Equivalent to `jumpTo({zoom: zoom})`.
49977
50011
  *
50012
+ * Triggers the following events: `movestart`, `move`, `moveend`, `zoomstart`, `zoom`, and `zoomend`.
50013
+ *
49978
50014
  * @param zoom - The zoom level to set (0-20).
49979
50015
  * @param eventData - Additional properties to be added to event objects of events triggered by this method.
49980
- * @event `movestart`
49981
- * @event `zoomstart`
49982
- * @event `move`
49983
- * @event `zoom`
49984
- * @event `moveend`
49985
- * @event `zoomend`
49986
50016
  * @returns `this`
49987
50017
  * @example
49988
50018
  * Zoom to the zoom level 5 without an animated transition
@@ -49997,15 +50027,11 @@ class Camera extends performance.Evented {
49997
50027
  /**
49998
50028
  * Zooms the map to the specified zoom level, with an animated transition.
49999
50029
  *
50030
+ * Triggers the following events: `movestart`, `move`, `moveend`, `zoomstart`, `zoom`, and `zoomend`.
50031
+ *
50000
50032
  * @param zoom - The zoom level to transition to.
50001
50033
  * @param options - Options object
50002
50034
  * @param eventData - Additional properties to be added to event objects of events triggered by this method.
50003
- * @event `movestart`
50004
- * @event `zoomstart`
50005
- * @event `move`
50006
- * @event `zoom`
50007
- * @event `moveend`
50008
- * @event `zoomend`
50009
50035
  * @returns `this`
50010
50036
  * @example
50011
50037
  * ```ts
@@ -50026,14 +50052,10 @@ class Camera extends performance.Evented {
50026
50052
  /**
50027
50053
  * Increases the map's zoom level by 1.
50028
50054
  *
50055
+ * Triggers the following events: `movestart`, `move`, `moveend`, `zoomstart`, `zoom`, and `zoomend`.
50056
+ *
50029
50057
  * @param options - Options object
50030
50058
  * @param eventData - Additional properties to be added to event objects of events triggered by this method.
50031
- * @event `movestart`
50032
- * @event `zoomstart`
50033
- * @event `move`
50034
- * @event `zoom`
50035
- * @event `moveend`
50036
- * @event `zoomend`
50037
50059
  * @returns `this`
50038
50060
  * @example
50039
50061
  * Zoom the map in one level with a custom animation duration
@@ -50048,14 +50070,10 @@ class Camera extends performance.Evented {
50048
50070
  /**
50049
50071
  * Decreases the map's zoom level by 1.
50050
50072
  *
50073
+ * Triggers the following events: `movestart`, `move`, `moveend`, `zoomstart`, `zoom`, and `zoomend`.
50074
+ *
50051
50075
  * @param options - Options object
50052
50076
  * @param eventData - Additional properties to be added to event objects of events triggered by this method.
50053
- * @event `movestart`
50054
- * @event `zoomstart`
50055
- * @event `move`
50056
- * @event `zoom`
50057
- * @event `moveend`
50058
- * @event `zoomend`
50059
50077
  * @returns `this`
50060
50078
  * @example
50061
50079
  * Zoom the map out one level with a custom animation offset
@@ -50081,10 +50099,10 @@ class Camera extends performance.Evented {
50081
50099
  *
50082
50100
  * Equivalent to `jumpTo({bearing: bearing})`.
50083
50101
  *
50102
+ * Triggers the following events: `movestart`, `moveend`, and `rotate`.
50103
+ *
50084
50104
  * @param bearing - The desired bearing.
50085
50105
  * @param eventData - Additional properties to be added to event objects of events triggered by this method.
50086
- * @event `movestart`
50087
- * @event `moveend`
50088
50106
  * @returns `this`
50089
50107
  * @example
50090
50108
  * Rotate the map to 90 degrees
@@ -50107,10 +50125,10 @@ class Camera extends performance.Evented {
50107
50125
  *
50108
50126
  * Equivalent to `jumpTo({padding: padding})`.
50109
50127
  *
50128
+ * Triggers the following events: `movestart` and `moveend`.
50129
+ *
50110
50130
  * @param padding - The desired padding.
50111
50131
  * @param eventData - Additional properties to be added to event objects of events triggered by this method.
50112
- * @event `movestart`
50113
- * @event `moveend`
50114
50132
  * @returns `this`
50115
50133
  * @example
50116
50134
  * Sets a left padding of 300px, and a top padding of 50px
@@ -50126,11 +50144,11 @@ class Camera extends performance.Evented {
50126
50144
  * Rotates the map to the specified bearing, with an animated transition. The bearing is the compass direction
50127
50145
  * that is "up"; for example, a bearing of 90° orients the map so that east is up.
50128
50146
  *
50147
+ * Triggers the following events: `movestart`, `moveend`, and `rotate`.
50148
+ *
50129
50149
  * @param bearing - The desired bearing.
50130
50150
  * @param options - Options object
50131
50151
  * @param eventData - Additional properties to be added to event objects of events triggered by this method.
50132
- * @event `movestart`
50133
- * @event `moveend`
50134
50152
  * @returns `this`
50135
50153
  */
50136
50154
  rotateTo(bearing, options, eventData) {
@@ -50141,10 +50159,10 @@ class Camera extends performance.Evented {
50141
50159
  /**
50142
50160
  * Rotates the map so that north is up (0° bearing), with an animated transition.
50143
50161
  *
50162
+ * Triggers the following events: `movestart`, `moveend`, and `rotate`.
50163
+ *
50144
50164
  * @param options - Options object
50145
50165
  * @param eventData - Additional properties to be added to event objects of events triggered by this method.
50146
- * @event `movestart`
50147
- * @event `moveend`
50148
50166
  * @returns `this`
50149
50167
  */
50150
50168
  resetNorth(options, eventData) {
@@ -50154,10 +50172,10 @@ class Camera extends performance.Evented {
50154
50172
  /**
50155
50173
  * Rotates and pitches the map so that north is up (0° bearing) and pitch is 0°, with an animated transition.
50156
50174
  *
50175
+ * Triggers the following events: `movestart`, `move`, `moveend`, `pitchstart`, `pitch`, `pitchend`, and `rotate`.
50176
+ *
50157
50177
  * @param options - Options object
50158
50178
  * @param eventData - Additional properties to be added to event objects of events triggered by this method.
50159
- * @event `movestart`
50160
- * @event `moveend`
50161
50179
  * @returns `this`
50162
50180
  */
50163
50181
  resetNorthPitch(options, eventData) {
@@ -50172,10 +50190,10 @@ class Camera extends performance.Evented {
50172
50190
  * Snaps the map so that north is up (0° bearing), if the current bearing is close enough to it (i.e. within the
50173
50191
  * `bearingSnap` threshold).
50174
50192
  *
50193
+ * Triggers the following events: `movestart`, `moveend`, and `rotate`.
50194
+ *
50175
50195
  * @param options - Options object
50176
50196
  * @param eventData - Additional properties to be added to event objects of events triggered by this method.
50177
- * @event `movestart`
50178
- * @event `moveend`
50179
50197
  * @returns `this`
50180
50198
  */
50181
50199
  snapToNorth(options, eventData) {
@@ -50193,11 +50211,10 @@ class Camera extends performance.Evented {
50193
50211
  /**
50194
50212
  * Sets the map's pitch (tilt). Equivalent to `jumpTo({pitch: pitch})`.
50195
50213
  *
50214
+ * Triggers the following events: `movestart`, `moveend`, `pitchstart`, and `pitchend`.
50215
+ *
50196
50216
  * @param pitch - The pitch to set, measured in degrees away from the plane of the screen (0-60).
50197
50217
  * @param eventData - Additional properties to be added to event objects of events triggered by this method.
50198
- * @event `pitchstart`
50199
- * @event `movestart`
50200
- * @event `moveend`
50201
50218
  * @returns `this`
50202
50219
  */
50203
50220
  setPitch(pitch, eventData) {
@@ -50225,6 +50242,7 @@ class Camera extends performance.Evented {
50225
50242
  return this._cameraForBoxAndBearing(bounds.getNorthWest(), bounds.getSouthEast(), bearing, options);
50226
50243
  }
50227
50244
  /**
50245
+ * @internal
50228
50246
  * Calculate the center of these two points in the viewport and use
50229
50247
  * the highest zoom level up to and including `Map#getMaxZoom()` that fits
50230
50248
  * the points in the viewport at the specified bearing.
@@ -50234,7 +50252,6 @@ class Camera extends performance.Evented {
50234
50252
  * @param options - the camera options
50235
50253
  * @returns If map is able to fit to provided bounds, returns `center`, `zoom`, and `bearing`.
50236
50254
  * If map is unable to fit, method will warn and return undefined.
50237
- * @hidden
50238
50255
  * @example
50239
50256
  * ```ts
50240
50257
  * let p0 = [-79, 43];
@@ -50305,12 +50322,12 @@ class Camera extends performance.Evented {
50305
50322
  * Pans and zooms the map to contain its visible area within the specified geographical bounds.
50306
50323
  * This function will also reset the map's bearing to 0 if bearing is nonzero.
50307
50324
  *
50325
+ * Triggers the following events: `movestart` and `moveend`.
50326
+ *
50308
50327
  * @param bounds - Center these bounds in the viewport and use the highest
50309
50328
  * zoom level up to and including `Map#getMaxZoom()` that fits them in the viewport.
50310
50329
  * @param options- Options supports all properties from {@link AnimationOptions} and {@link CameraOptions} in addition to the fields below.
50311
50330
  * @param eventData - Additional properties to be added to event objects of events triggered by this method.
50312
- * @event `movestart`
50313
- * @event `moveend`
50314
50331
  * @returns `this`
50315
50332
  * @example
50316
50333
  * ```ts
@@ -50329,13 +50346,13 @@ class Camera extends performance.Evented {
50329
50346
  * once the map is rotated to the specified bearing. To zoom without rotating,
50330
50347
  * pass in the current map bearing.
50331
50348
  *
50349
+ * Triggers the following events: `movestart`, `move`, `moveend`, `zoomstart`, `zoom`, `zoomend` and `rotate`.
50350
+ *
50332
50351
  * @param p0 - First point on screen, in pixel coordinates
50333
50352
  * @param p1 - Second point on screen, in pixel coordinates
50334
50353
  * @param bearing - Desired map bearing at end of animation, in degrees
50335
50354
  * @param options - Options object
50336
50355
  * @param eventData - Additional properties to be added to event objects of events triggered by this method.
50337
- * @event `movestart`
50338
- * @event `moveend`
50339
50356
  * @returns `this`
50340
50357
  * @example
50341
50358
  * ```ts
@@ -50366,18 +50383,11 @@ class Camera extends performance.Evented {
50366
50383
  * an animated transition. The map will retain its current values for any
50367
50384
  * details not specified in `options`.
50368
50385
  *
50386
+ * Triggers the following events: `movestart`, `move`, `moveend`, `zoomstart`, `zoom`, `zoomend`, `pitchstart`,
50387
+ * `pitch`, `pitchend`, and `rotate`.
50388
+ *
50369
50389
  * @param options - Options object
50370
50390
  * @param eventData - Additional properties to be added to event objects of events triggered by this method.
50371
- * @event `movestart`
50372
- * @event `zoomstart`
50373
- * @event `pitchstart`
50374
- * @event `rotate`
50375
- * @event `move`
50376
- * @event `zoom`
50377
- * @event `pitch`
50378
- * @event `moveend`
50379
- * @event `zoomend`
50380
- * @event `pitchend`
50381
50391
  * @returns `this`
50382
50392
  * @example
50383
50393
  * ```ts
@@ -50475,19 +50485,12 @@ class Camera extends performance.Evented {
50475
50485
  * the `reduced motion` accessibility feature enabled in their operating system,
50476
50486
  * unless `options` includes `essential: true`.
50477
50487
  *
50488
+ * Triggers the following events: `movestart`, `move`, `moveend`, `zoomstart`, `zoom`, `zoomend`, `pitchstart`,
50489
+ * `pitch`, `pitchend`, and `rotate`.
50490
+ *
50478
50491
  * @param options - Options describing the destination and animation of the transition.
50479
50492
  * Accepts {@link CameraOptions} and {@link AnimationOptions}.
50480
50493
  * @param eventData - Additional properties to be added to event objects of events triggered by this method.
50481
- * @event `movestart`
50482
- * @event `zoomstart`
50483
- * @event `pitchstart`
50484
- * @event `rotate`
50485
- * @event `move`
50486
- * @event `zoom`
50487
- * @event `pitch`
50488
- * @event `moveend`
50489
- * @event `zoomend`
50490
- * @event `pitchend`
50491
50494
  * @returns `this`
50492
50495
  * @see [Navigate the map with game-like controls](https://maplibre.org/maplibre-gl-js/docs/examples/game-controls/)
50493
50496
  */
@@ -50585,11 +50588,12 @@ class Camera extends performance.Evented {
50585
50588
  _prepareElevation(center) {
50586
50589
  this._elevationCenter = center;
50587
50590
  this._elevationStart = this.transform.elevation;
50588
- this._elevationTarget = this.transform.getElevation(center, this.terrain);
50589
- this.transform.freezeElevation = true;
50591
+ this._elevationTarget = this.terrain.getElevationForLngLatZoom(center, this.transform.tileZoom);
50592
+ this._elevationFreeze = true;
50590
50593
  }
50591
50594
  _updateElevation(k) {
50592
- const elevation = this.transform.getElevation(this._elevationCenter, this.terrain);
50595
+ this.transform._minEleveationForCurrentTile = this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter, this.transform.tileZoom);
50596
+ const elevation = this.terrain.getElevationForLngLatZoom(this._elevationCenter, this.transform.tileZoom);
50593
50597
  // target terrain updated during flight, slowly move camera to new height
50594
50598
  if (k < 1 && elevation !== this._elevationTarget) {
50595
50599
  const pitch1 = this._elevationTarget - this._elevationStart;
@@ -50600,10 +50604,11 @@ class Camera extends performance.Evented {
50600
50604
  this.transform.elevation = performance.interpolate.number(this._elevationStart, this._elevationTarget, k);
50601
50605
  }
50602
50606
  _finalizeElevation() {
50603
- this.transform.freezeElevation = false;
50607
+ this._elevationFreeze = false;
50604
50608
  this.transform.recalculateZoom(this.terrain);
50605
50609
  }
50606
50610
  /**
50611
+ * @internal
50607
50612
  * Called when the camera is about to be manipulated.
50608
50613
  * If `transformCameraUpdate` is specified, a copy of the current transform is created to track the accumulated changes.
50609
50614
  * This underlying transform represents the "desired state" proposed by input handlers / animations / UI controls.
@@ -50619,6 +50624,7 @@ class Camera extends performance.Evented {
50619
50624
  return this._requestedCameraState;
50620
50625
  }
50621
50626
  /**
50627
+ * @internal
50622
50628
  * Called after the camera is done being manipulated.
50623
50629
  * @param tr - the requested camera end state
50624
50630
  * Call `transformCameraUpdate` if present, and then apply the "approved" changes.
@@ -50687,20 +50693,13 @@ class Camera extends performance.Evented {
50687
50693
  * if the user has the `reduced motion` accessibility feature enabled in their operating system,
50688
50694
  * unless 'options' includes `essential: true`.
50689
50695
  *
50696
+ * Triggers the following events: `movestart`, `move`, `moveend`, `zoomstart`, `zoom`, `zoomend`, `pitchstart`,
50697
+ * `pitch`, `pitchend`, and `rotate`.
50698
+ *
50690
50699
  * @param options - Options describing the destination and animation of the transition.
50691
50700
  * Accepts {@link CameraOptions}, {@link AnimationOptions},
50692
50701
  * and the following additional options.
50693
50702
  * @param eventData - Additional properties to be added to event objects of events triggered by this method.
50694
- * @event `movestart`
50695
- * @event `zoomstart`
50696
- * @event `pitchstart`
50697
- * @event `move`
50698
- * @event `zoom`
50699
- * @event `rotate`
50700
- * @event `pitch`
50701
- * @event `moveend`
50702
- * @event `zoomend`
50703
- * @event `pitchend`
50704
50703
  * @returns `this`
50705
50704
  * @example
50706
50705
  * ```ts
@@ -50929,9 +50928,9 @@ class Camera extends performance.Evented {
50929
50928
  if (!this.terrain) {
50930
50929
  return null;
50931
50930
  }
50932
- const elevation = this.transform.getElevation(performance.LngLat.convert(lngLatLike), this.terrain);
50931
+ const elevation = this.terrain.getElevationForLngLatZoom(performance.LngLat.convert(lngLatLike), this.transform.tileZoom);
50933
50932
  /**
50934
- * Different zoomlevels with different terrain-tiles the elvation-values are not the same.
50933
+ * Different zoomlevels with different terrain-tiles the elevation-values are not the same.
50935
50934
  * map.transform.elevation variable with the center-altitude.
50936
50935
  * In maplibre the proj-matrix is translated by this value in negative z-direction.
50937
50936
  * So we need to add this value to the elevation to get the correct value.
@@ -51229,6 +51228,7 @@ var pos3dAttributes = performance.createLayout([
51229
51228
  ]);
51230
51229
 
51231
51230
  /**
51231
+ * @internal
51232
51232
  * This class is a helper for the Terrain-class, it:
51233
51233
  * - loads raster-dem tiles
51234
51234
  * - manages all renderToTexture tiles.
@@ -51387,6 +51387,7 @@ class TerrainSourceCache extends performance.Evented {
51387
51387
  }
51388
51388
 
51389
51389
  /**
51390
+ * @internal
51390
51391
  * This is the main class which handles most of the 3D Terrain logic. It has the following topics:
51391
51392
  * 1) loads raster-dem tiles via the internal sourceCache this.sourceCache
51392
51393
  * 2) creates a depth-framebuffer, which is used to calculate the visibility of coordinates
@@ -51451,7 +51452,17 @@ class Terrain {
51451
51452
  dem.get(cx + 1, cy + 1) * (tx) * (ty));
51452
51453
  }
51453
51454
  /**
51454
- * get the Elevation for given coordinate in respect of exaggeration.
51455
+ * Get the elevation for given {@link LngLat} in respect of exaggeration.
51456
+ * @param lnglat - the location
51457
+ * @param zoom - the zoom
51458
+ * @returns the elevation
51459
+ */
51460
+ getElevationForLngLatZoom(lnglat, zoom) {
51461
+ const { tileID, mercatorX, mercatorY } = this._getOverscaledTileIDFromLngLatZoom(lnglat, zoom);
51462
+ return this.getElevation(tileID, mercatorX % performance.EXTENT, mercatorY % performance.EXTENT, performance.EXTENT);
51463
+ }
51464
+ /**
51465
+ * Get the elevation for given coordinate in respect of exaggeration.
51455
51466
  * @param tileID - the tile id
51456
51467
  * @param x - between 0 .. EXTENT
51457
51468
  * @param y - between 0 .. EXTENT
@@ -51665,6 +51676,11 @@ class Terrain {
51665
51676
  // divide by 5 is evaluated by trial & error to get a frame in the right height
51666
51677
  return 2 * Math.PI * performance.earthRadius / Math.pow(2, zoom) / 5;
51667
51678
  }
51679
+ getMinTileElevationForLngLatZoom(lnglat, zoom) {
51680
+ var _a;
51681
+ const { tileID } = this._getOverscaledTileIDFromLngLatZoom(lnglat, zoom);
51682
+ return (_a = this.getMinMaxElevation(tileID).minElevation) !== null && _a !== void 0 ? _a : 0;
51683
+ }
51668
51684
  /**
51669
51685
  * Get the minimum and maximum elevation contained in a tile. This includes any
51670
51686
  * exaggeration included in the terrain.
@@ -51682,10 +51698,24 @@ class Terrain {
51682
51698
  }
51683
51699
  return minMax;
51684
51700
  }
51701
+ _getOverscaledTileIDFromLngLatZoom(lnglat, zoom) {
51702
+ const mercatorCoordinate = performance.MercatorCoordinate.fromLngLat(lnglat.wrap());
51703
+ const worldSize = (1 << zoom) * performance.EXTENT;
51704
+ const mercatorX = mercatorCoordinate.x * worldSize;
51705
+ const mercatorY = mercatorCoordinate.y * worldSize;
51706
+ const tileX = Math.floor(mercatorX / performance.EXTENT), tileY = Math.floor(mercatorY / performance.EXTENT);
51707
+ const tileID = new performance.OverscaledTileID(zoom, 0, zoom, tileX, tileY);
51708
+ return {
51709
+ tileID,
51710
+ mercatorX,
51711
+ mercatorY
51712
+ };
51713
+ }
51685
51714
  }
51686
51715
 
51687
51716
  /**
51688
- * RenderPool a resource pool for textures and framebuffers
51717
+ * @internal
51718
+ * `RenderPool` is a resource pool for textures and framebuffers
51689
51719
  */
51690
51720
  class RenderPool {
51691
51721
  constructor(_context, _size, _tileSize) {
@@ -51749,7 +51779,9 @@ class RenderPool {
51749
51779
  }
51750
51780
  }
51751
51781
 
51752
- // lookup table which layers should rendered to texture
51782
+ /**
51783
+ * lookup table which layers should rendered to texture
51784
+ */
51753
51785
  const LAYERS = {
51754
51786
  background: true,
51755
51787
  fill: true,
@@ -51758,7 +51790,8 @@ const LAYERS = {
51758
51790
  hillshade: true
51759
51791
  };
51760
51792
  /**
51761
- * RenderToTexture
51793
+ * @internal
51794
+ * A helper class to help define what should be rendered to texture and how
51762
51795
  */
51763
51796
  class RenderToTexture {
51764
51797
  constructor(painter, terrain) {
@@ -51934,7 +51967,7 @@ const defaultOptions$4 = {
51934
51967
  fadeDuration: 300,
51935
51968
  crossSourceCollisions: true,
51936
51969
  validateStyle: true,
51937
- /** Because GL MAX_TEXTURE_SIZE is usually at least 4096px. */
51970
+ /**Because GL MAX_TEXTURE_SIZE is usually at least 4096px. */
51938
51971
  maxCanvasSize: [4096, 4096]
51939
51972
  };
51940
51973
  /**
@@ -52123,6 +52156,7 @@ let Map$1 = class Map extends Camera {
52123
52156
  });
52124
52157
  }
52125
52158
  /**
52159
+ * @internal
52126
52160
  * Returns a unique number for this map instance which is used for the MapLoadEvent
52127
52161
  * to make sure we only fire one event per instantiated map object.
52128
52162
  * @returns the uniq map ID
@@ -52133,6 +52167,8 @@ let Map$1 = class Map extends Camera {
52133
52167
  /**
52134
52168
  * Adds an {@link IControl} to the map, calling `control.onAdd(this)`.
52135
52169
  *
52170
+ * An {@link ErrorEvent} will be fired if the image parameter is invald.
52171
+ *
52136
52172
  * @param control - The {@link IControl} to add.
52137
52173
  * @param position - position on the map to which the control will be added.
52138
52174
  * Valid values are `'top-left'`, `'top-right'`, `'bottom-left'`, and `'bottom-right'`. Defaults to `'top-right'`.
@@ -52170,6 +52206,8 @@ let Map$1 = class Map extends Camera {
52170
52206
  /**
52171
52207
  * Removes the control from the map.
52172
52208
  *
52209
+ * An {@link ErrorEvent} will be fired if the image parameter is invald.
52210
+ *
52173
52211
  * @param control - The {@link IControl} to remove.
52174
52212
  * @returns `this`
52175
52213
  * @example
@@ -52212,7 +52250,7 @@ let Map$1 = class Map extends Camera {
52212
52250
  }
52213
52251
  calculateCameraOptionsFromTo(from, altitudeFrom, to, altitudeTo) {
52214
52252
  if (altitudeTo == null && this.terrain) {
52215
- altitudeTo = this.transform.getElevation(to, this.terrain);
52253
+ altitudeTo = this.terrain.getElevationForLngLatZoom(to, this.transform.tileZoom);
52216
52254
  }
52217
52255
  return super.calculateCameraOptionsFromTo(from, altitudeFrom, to, altitudeTo);
52218
52256
  }
@@ -52224,6 +52262,8 @@ let Map$1 = class Map extends Camera {
52224
52262
  * This method must be called after the map's `container` is resized programmatically
52225
52263
  * or when the map is shown after being initially hidden with CSS.
52226
52264
  *
52265
+ * Triggers the following events: `movestart`, `move`, `moveend`, and `resize`.
52266
+ *
52227
52267
  * @param eventData - Additional properties to be passed to `movestart`, `move`, `resize`, and `moveend`
52228
52268
  * events that get triggered as a result of resize. This can be useful for differentiating the
52229
52269
  * source of an event (for example, user-initiated or programmatically-triggered events).
@@ -52265,7 +52305,8 @@ let Map$1 = class Map extends Camera {
52265
52305
  this.fire(new performance.Event('moveend', eventData));
52266
52306
  return this;
52267
52307
  }
52268
- /*
52308
+ /**
52309
+ * @internal
52269
52310
  * Return the map's pixel ratio eventually scaled down to respect maxCanvasSize.
52270
52311
  * Internally you should use this and not getPixelRatio().
52271
52312
  */
@@ -52358,6 +52399,8 @@ let Map$1 = class Map extends Camera {
52358
52399
  * if the map is 512px tall it will not be possible to zoom below zoom 0
52359
52400
  * no matter what the `minZoom` is set to.
52360
52401
  *
52402
+ * A {@link ErrorEvent} event will be fired if minZoom is out of bounds.
52403
+ *
52361
52404
  * @param minZoom - The minimum zoom level to set (-2 - 24).
52362
52405
  * If `null` or `undefined` is provided, the function removes the current minimum zoom (i.e. sets it to -2).
52363
52406
  * @returns `this`
@@ -52393,6 +52436,8 @@ let Map$1 = class Map extends Camera {
52393
52436
  * If the map's current zoom level is higher than the new maximum,
52394
52437
  * the map will zoom to the new maximum.
52395
52438
  *
52439
+ * A {@link ErrorEvent} event will be fired if minZoom is out of bounds.
52440
+ *
52396
52441
  * @param maxZoom - The maximum zoom level to set.
52397
52442
  * If `null` or `undefined` is provided, the function removes the current maximum zoom (sets it to 22).
52398
52443
  * @returns `this`
@@ -52428,6 +52473,8 @@ let Map$1 = class Map extends Camera {
52428
52473
  * If the map's current pitch is lower than the new minimum,
52429
52474
  * the map will pitch to the new minimum.
52430
52475
  *
52476
+ * A {@link ErrorEvent} event will be fired if minPitch is out of bounds.
52477
+ *
52431
52478
  * @param minPitch - The minimum pitch to set (0-85). Values greater than 60 degrees are experimental and may result in rendering issues. If you encounter any, please raise an issue with details in the MapLibre project.
52432
52479
  * If `null` or `undefined` is provided, the function removes the current minimum pitch (i.e. sets it to 0).
52433
52480
  * @returns `this`
@@ -52458,6 +52505,8 @@ let Map$1 = class Map extends Camera {
52458
52505
  * If the map's current pitch is higher than the new maximum,
52459
52506
  * the map will pitch to the new maximum.
52460
52507
  *
52508
+ * A {@link ErrorEvent} event will be fired if maxPitch is out of bounds.
52509
+ *
52461
52510
  * @param maxPitch - The maximum pitch to set (0-85). Values greater than 60 degrees are experimental and may result in rendering issues. If you encounter any, please raise an issue with details in the MapLibre project.
52462
52511
  * If `null` or `undefined` is provided, the function removes the current maximum pitch (sets it to 60).
52463
52512
  * @returns `this`
@@ -52661,13 +52710,6 @@ let Map$1 = class Map extends Camera {
52661
52710
  return { layer: layerId, listener, delegates: { [type]: delegate } };
52662
52711
  }
52663
52712
  }
52664
- /**
52665
- * This is an overload of the `on` method that allows to listen to events based on the `layerId`
52666
- * @param type - The type of the event.
52667
- * @param layerIdOrListener - The ID of the layer.
52668
- * @param listener - The listener callback.
52669
- * @returns `this`
52670
- */
52671
52713
  on(type, layerIdOrListener, listener) {
52672
52714
  if (listener === undefined) {
52673
52715
  return super.on(type, layerIdOrListener);
@@ -53026,11 +53068,14 @@ let Map$1 = class Map extends Camera {
53026
53068
  /**
53027
53069
  * Adds a source to the map's style.
53028
53070
  *
53071
+ * Events triggered:
53072
+ *
53073
+ * Triggers the `source.add` event.
53074
+ *
53029
53075
  * @param id - The ID of the source to add. Must not conflict with existing sources.
53030
53076
  * @param source - The source object, conforming to the
53031
- * MapLibre Style Specification's [source definition](https://maplibre.org/maplibre-style-spec/#sources) or
53077
+ * MapLibre Style Specification's [source definition](https://maplibre.org/maplibre-style-spec/sources) or
53032
53078
  * {@link CanvasSourceSpecification}.
53033
- * @event `source.add`
53034
53079
  * @returns `this`
53035
53080
  * @example
53036
53081
  * ```ts
@@ -53067,6 +53112,8 @@ let Map$1 = class Map extends Camera {
53067
53112
  * Returns a Boolean indicating whether the source is loaded. Returns `true` if the source with
53068
53113
  * the given ID in the map's style has no outstanding network requests, otherwise `false`.
53069
53114
  *
53115
+ * A {@link ErrorEvent} event will be fired if there is no source wit the specified ID.
53116
+ *
53070
53117
  * @param id - The ID of the source to be checked.
53071
53118
  * @returns A Boolean indicating whether the source is loaded.
53072
53119
  * @example
@@ -53084,6 +53131,9 @@ let Map$1 = class Map extends Camera {
53084
53131
  }
53085
53132
  /**
53086
53133
  * Loads a 3D terrain mesh, based on a "raster-dem" source.
53134
+ *
53135
+ * Triggers the `terrain` event.
53136
+ *
53087
53137
  * @param options - Options object.
53088
53138
  * @returns `this`
53089
53139
  * @example
@@ -53104,7 +53154,8 @@ let Map$1 = class Map extends Camera {
53104
53154
  if (this.painter.renderToTexture)
53105
53155
  this.painter.renderToTexture.destruct();
53106
53156
  this.painter.renderToTexture = null;
53107
- this.transform.updateElevation(this.terrain);
53157
+ this.transform._minEleveationForCurrentTile = 0;
53158
+ this.transform.elevation = 0;
53108
53159
  }
53109
53160
  else {
53110
53161
  // add terrain
@@ -53120,14 +53171,17 @@ let Map$1 = class Map extends Camera {
53120
53171
  }
53121
53172
  this.terrain = new Terrain(this.painter, sourceCache, options);
53122
53173
  this.painter.renderToTexture = new RenderToTexture(this.painter, this.terrain);
53123
- this.transform.updateElevation(this.terrain);
53174
+ this.transform._minEleveationForCurrentTile = this.terrain.getMinTileElevationForLngLatZoom(this.transform.center, this.transform.tileZoom);
53175
+ this.transform.elevation = this.terrain.getElevationForLngLatZoom(this.transform.center, this.transform.tileZoom);
53124
53176
  this._terrainDataCallback = e => {
53125
53177
  if (e.dataType === 'style') {
53126
53178
  this.terrain.sourceCache.freeRtt();
53127
53179
  }
53128
53180
  else if (e.dataType === 'source' && e.tile) {
53129
- if (e.sourceId === options.source)
53130
- this.transform.updateElevation(this.terrain);
53181
+ if (e.sourceId === options.source && !this._elevationFreeze) {
53182
+ this.transform._minEleveationForCurrentTile = this.terrain.getMinTileElevationForLngLatZoom(this.transform.center, this.transform.tileZoom);
53183
+ this.transform.elevation = this.terrain.getElevationForLngLatZoom(this.transform.center, this.transform.tileZoom);
53184
+ }
53131
53185
  this.terrain.sourceCache.freeRtt(e.tile.tileID);
53132
53186
  }
53133
53187
  };
@@ -53223,11 +53277,12 @@ let Map$1 = class Map extends Camera {
53223
53277
  /**
53224
53278
  * Add an image to the style. This image can be displayed on the map like any other icon in the style's
53225
53279
  * sprite using the image's ID with
53226
- * [`icon-image`](https://maplibre.org/maplibre-style-spec/#layout-symbol-icon-image),
53227
- * [`background-pattern`](https://maplibre.org/maplibre-style-spec/#paint-background-background-pattern),
53228
- * [`fill-pattern`](https://maplibre.org/maplibre-style-spec/#paint-fill-fill-pattern),
53229
- * or [`line-pattern`](https://maplibre.org/maplibre-style-spec/#paint-line-line-pattern).
53230
- * A {@link ErrorEvent} event will be fired if there is not enough space in the sprite to add this image.
53280
+ * [`icon-image`](https://maplibre.org/maplibre-style-spec/layers/#layout-symbol-icon-image),
53281
+ * [`background-pattern`](https://maplibre.org/maplibre-style-spec/layers/#paint-background-background-pattern),
53282
+ * [`fill-pattern`](https://maplibre.org/maplibre-style-spec/layers/#paint-fill-fill-pattern),
53283
+ * or [`line-pattern`](https://maplibre.org/maplibre-style-spec/layers/#paint-line-line-pattern).
53284
+ *
53285
+ * A {@link ErrorEvent} event will be fired if the image parameter is invalid or there is not enough space in the sprite to add this image.
53231
53286
  *
53232
53287
  * @param id - The ID of the image.
53233
53288
  * @param image - The image as an `HTMLImageElement`, `ImageData`, `ImageBitmap` or object with `width`, `height`, and `data`
@@ -53293,10 +53348,12 @@ let Map$1 = class Map extends Camera {
53293
53348
  /**
53294
53349
  * Update an existing image in a style. This image can be displayed on the map like any other icon in the style's
53295
53350
  * sprite using the image's ID with
53296
- * [`icon-image`](https://maplibre.org/maplibre-style-spec/#layout-symbol-icon-image),
53297
- * [`background-pattern`](https://maplibre.org/maplibre-style-spec/#paint-background-background-pattern),
53298
- * [`fill-pattern`](https://maplibre.org/maplibre-style-spec/#paint-fill-fill-pattern),
53299
- * or [`line-pattern`](https://maplibre.org/maplibre-style-spec/#paint-line-line-pattern).
53351
+ * [`icon-image`](https://maplibre.org/maplibre-style-spec/layers/#layout-symbol-icon-image),
53352
+ * [`background-pattern`](https://maplibre.org/maplibre-style-spec/layers/#paint-background-background-pattern),
53353
+ * [`fill-pattern`](https://maplibre.org/maplibre-style-spec/layers/#paint-fill-fill-pattern),
53354
+ * or [`line-pattern`](https://maplibre.org/maplibre-style-spec/layers/#paint-line-line-pattern).
53355
+ *
53356
+ * An {@link ErrorEvent} will be fired if the image parameter is invald.
53300
53357
  *
53301
53358
  * @param id - The ID of the image.
53302
53359
  * @param image - The image as an `HTMLImageElement`, `ImageData`, `ImageBitmap` or object with `width`, `height`, and `data`
@@ -53351,6 +53408,8 @@ let Map$1 = class Map extends Camera {
53351
53408
  * in the style's original sprite and any images
53352
53409
  * that have been added at runtime using {@link Map#addImage}.
53353
53410
  *
53411
+ * An {@link ErrorEvent} will be fired if the image parameter is invald.
53412
+ *
53354
53413
  * @param id - The ID of the image.
53355
53414
  *
53356
53415
  * @returns A Boolean indicating whether the image exists.
@@ -53421,14 +53480,14 @@ let Map$1 = class Map extends Camera {
53421
53480
  return this.style.listImages();
53422
53481
  }
53423
53482
  /**
53424
- * Adds a [MapLibre style layer](https://maplibre.org/maplibre-style-spec/#layers)
53483
+ * Adds a [MapLibre style layer](https://maplibre.org/maplibre-style-spec/layers)
53425
53484
  * to the map's style.
53426
53485
  *
53427
53486
  * A layer defines how data from a specified source will be styled. Read more about layer types
53428
- * and available paint and layout properties in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/#layers).
53487
+ * and available paint and layout properties in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/layers).
53429
53488
  *
53430
53489
  * @param layer - The layer to add,
53431
- * conforming to either the MapLibre Style Specification's [layer definition](https://maplibre.org/maplibre-style-spec/#layers) or,
53490
+ * conforming to either the MapLibre Style Specification's [layer definition](https://maplibre.org/maplibre-style-spec/layers) or,
53432
53491
  * less commonly, the {@link CustomLayerInterface} specification.
53433
53492
  * The MapLibre Style Specification's layer definition is appropriate for most layers.
53434
53493
  *
@@ -53526,10 +53585,9 @@ let Map$1 = class Map extends Camera {
53526
53585
  /**
53527
53586
  * Removes the layer with the given ID from the map's style.
53528
53587
  *
53529
- * If no such layer exists, an `error` event is fired.
53588
+ * An {@link ErrorEvent} will be fired if the image parameter is invald.
53530
53589
  *
53531
53590
  * @param id - The ID of the layer to remove
53532
- * @event `error`
53533
53591
  * @returns `this`
53534
53592
  *
53535
53593
  * @example
@@ -53561,8 +53619,8 @@ let Map$1 = class Map extends Camera {
53561
53619
  }
53562
53620
  /**
53563
53621
  * Sets the zoom extent for the specified style layer. The zoom extent includes the
53564
- * [minimum zoom level](https://maplibre.org/maplibre-style-spec/#layer-minzoom)
53565
- * and [maximum zoom level](https://maplibre.org/maplibre-style-spec/#layer-maxzoom))
53622
+ * [minimum zoom level](https://maplibre.org/maplibre-style-spec/layers/#minzoom)
53623
+ * and [maximum zoom level](https://maplibre.org/maplibre-style-spec/layers/#maxzoom))
53566
53624
  * at which the layer will be rendered.
53567
53625
  *
53568
53626
  * Note: For style layers using vector sources, style layers cannot be rendered at zoom levels lower than the
@@ -53713,12 +53771,11 @@ let Map$1 = class Map extends Camera {
53713
53771
  return this.style.getGlyphsUrl();
53714
53772
  }
53715
53773
  /**
53716
- * Adds a sprite to the map's style.
53774
+ * Adds a sprite to the map's style. Fires the `style` event.
53717
53775
  *
53718
53776
  * @param id - The ID of the sprite to add. Must not conflict with existing sprites.
53719
53777
  * @param url - The URL to load the sprite from
53720
53778
  * @param options - Options object.
53721
- * @event `style`
53722
53779
  * @returns `this`
53723
53780
  * @example
53724
53781
  * ```ts
@@ -53735,10 +53792,9 @@ let Map$1 = class Map extends Camera {
53735
53792
  return this;
53736
53793
  }
53737
53794
  /**
53738
- * Removes the sprite from the map's style.
53795
+ * Removes the sprite from the map's style. Fires the `style` event.
53739
53796
  *
53740
53797
  * @param id - The ID of the sprite to remove. If the sprite is declared as a single URL, the ID must be "default".
53741
- * @event `style`
53742
53798
  * @returns `this`
53743
53799
  * @example
53744
53800
  * ```ts
@@ -53782,7 +53838,7 @@ let Map$1 = class Map extends Camera {
53782
53838
  /**
53783
53839
  * Sets the any combination of light values.
53784
53840
  *
53785
- * @param light - Light properties to set. Must conform to the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/#light).
53841
+ * @param light - Light properties to set. Must conform to the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/light).
53786
53842
  * @param options - Options object.
53787
53843
  * @returns `this`
53788
53844
  *
@@ -54002,6 +54058,8 @@ let Map$1 = class Map extends Camera {
54002
54058
  <div class="maplibregl-desktop-message">${desktopMessage}</div>
54003
54059
  <div class="maplibregl-mobile-message">${mobileMessage}</div>
54004
54060
  `;
54061
+ // Remove cooperative gesture screen from the accessibility tree since screenreaders cannot interact with the map using gestures
54062
+ this._cooperativeGesturesScreen.setAttribute('aria-hidden', 'true');
54005
54063
  // Add event to canvas container since gesture container is pointer-events: none
54006
54064
  this._canvasContainer.addEventListener('wheel', this._cooperativeGesturesOnWheel, false);
54007
54065
  // Add a cooperative gestures class (enable touch-action: pan-x pan-y;)
@@ -54075,6 +54133,7 @@ let Map$1 = class Map extends Camera {
54075
54133
  return !this._styleDirty && !this._sourcesDirty && !!this.style && this.style.loaded();
54076
54134
  }
54077
54135
  /**
54136
+ * @internal
54078
54137
  * Update this map's style and sources, and re-render the map.
54079
54138
  *
54080
54139
  * @param updateStyle - mark the map's style for reprocessing as
@@ -54090,8 +54149,10 @@ let Map$1 = class Map extends Camera {
54090
54149
  return this;
54091
54150
  }
54092
54151
  /**
54152
+ * @internal
54093
54153
  * Request that the given callback be executed during the next render
54094
54154
  * frame. Schedule a render frame if one is not already scheduled.
54155
+ *
54095
54156
  * @returns An id that can be used to cancel the callback
54096
54157
  */
54097
54158
  _requestRenderFrame(callback) {
@@ -54102,6 +54163,7 @@ let Map$1 = class Map extends Camera {
54102
54163
  this._renderTaskQueue.remove(id);
54103
54164
  }
54104
54165
  /**
54166
+ * @internal
54105
54167
  * Call when a (re-)render of the map is required:
54106
54168
  * - The style has changed (`setPaintProperty()`, etc.)
54107
54169
  * - Source data has changed (e.g. tiles have finished loading)
@@ -54151,9 +54213,17 @@ let Map$1 = class Map extends Camera {
54151
54213
  this.style._updateSources(this.transform);
54152
54214
  }
54153
54215
  // update terrain stuff
54154
- if (this.terrain)
54216
+ if (this.terrain) {
54155
54217
  this.terrain.sourceCache.update(this.transform, this.terrain);
54156
- this.transform.updateElevation(this.terrain);
54218
+ this.transform._minEleveationForCurrentTile = this.terrain.getMinTileElevationForLngLatZoom(this.transform.center, this.transform.tileZoom);
54219
+ if (!this._elevationFreeze) {
54220
+ this.transform.elevation = this.terrain.getElevationForLngLatZoom(this.transform.center, this.transform.tileZoom);
54221
+ }
54222
+ }
54223
+ else {
54224
+ this.transform._minEleveationForCurrentTile = 0;
54225
+ this.transform.elevation = 0;
54226
+ }
54157
54227
  this._placementDirty = this.style && this.style._updatePlacement(this.painter.transform, this.showCollisionBoxes, fadeDuration, this._crossSourceCollisions);
54158
54228
  // Actually draw
54159
54229
  this.painter.render(this.style, {