maplibre-gl 3.2.0 → 3.2.1

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.
@@ -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.1/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
  };
@@ -5077,7 +5074,7 @@ function hslToRgb([h, s, l, alpha]) {
5077
5074
  * or `undefined` if the input is not a valid color string.
5078
5075
  */
5079
5076
  function parseCssColor(input) {
5080
- input = input.toLowerCase();
5077
+ input = input.toLowerCase().trim();
5081
5078
  if (input === 'transparent') {
5082
5079
  return [0, 0, 0, 0];
5083
5080
  }
@@ -9002,7 +8999,7 @@ const filterSpec = {
9002
8999
  * passes its test.
9003
9000
  *
9004
9001
  * @private
9005
- * @param {Array} filter maplibre gl filter
9002
+ * @param {Array} filter MapLibre filter
9006
9003
  * @returns {Function} filter-evaluating function
9007
9004
  */
9008
9005
  function createFilter(filter) {
@@ -10723,7 +10720,7 @@ function validateGlyphsUrl(options) {
10723
10720
  }
10724
10721
 
10725
10722
  /**
10726
- * Validate a MapLibre GL style against the style specification. This entrypoint,
10723
+ * Validate a MapLibre style against the style specification. This entrypoint,
10727
10724
  * `maplibre-gl-style-spec/lib/validate_style.min`, is designed to produce as
10728
10725
  * small a browserify bundle as possible by omitting unnecessary functionality
10729
10726
  * and legacy style specifications.
@@ -31195,6 +31192,8 @@ class WorkerTile {
31195
31192
  this.collectResourceTiming = !!params.collectResourceTiming;
31196
31193
  this.returnDependencies = !!params.returnDependencies;
31197
31194
  this.promoteId = params.promoteId;
31195
+ this.inFlightDependencies = [];
31196
+ this.dependencySentinel = -1;
31198
31197
  }
31199
31198
  parse(data, layerIndex, availableImages, actor, callback) {
31200
31199
  this.status = 'parsing';
@@ -31259,40 +31258,53 @@ class WorkerTile {
31259
31258
  let iconMap;
31260
31259
  let patternMap;
31261
31260
  const stacks = performance.mapObject(options.glyphDependencies, (glyphs) => Object.keys(glyphs).map(Number));
31261
+ this.inFlightDependencies.forEach((request) => request === null || request === void 0 ? void 0 : request.cancel());
31262
+ this.inFlightDependencies = [];
31263
+ // cancelling seems to be not sufficient, we seems to still manage to get a callback hit, so use a sentinel to drop stale results
31264
+ const dependencySentinel = ++this.dependencySentinel;
31262
31265
  if (Object.keys(stacks).length) {
31263
- actor.send('getGlyphs', { uid: this.uid, stacks, source: this.source, tileID: this.tileID, type: 'glyphs' }, (err, result) => {
31266
+ this.inFlightDependencies.push(actor.send('getGlyphs', { uid: this.uid, stacks, source: this.source, tileID: this.tileID, type: 'glyphs' }, (err, result) => {
31267
+ if (dependencySentinel !== this.dependencySentinel) {
31268
+ return;
31269
+ }
31264
31270
  if (!error) {
31265
31271
  error = err;
31266
31272
  glyphMap = result;
31267
31273
  maybePrepare.call(this);
31268
31274
  }
31269
- });
31275
+ }));
31270
31276
  }
31271
31277
  else {
31272
31278
  glyphMap = {};
31273
31279
  }
31274
31280
  const icons = Object.keys(options.iconDependencies);
31275
31281
  if (icons.length) {
31276
- actor.send('getImages', { icons, source: this.source, tileID: this.tileID, type: 'icons' }, (err, result) => {
31282
+ this.inFlightDependencies.push(actor.send('getImages', { icons, source: this.source, tileID: this.tileID, type: 'icons' }, (err, result) => {
31283
+ if (dependencySentinel !== this.dependencySentinel) {
31284
+ return;
31285
+ }
31277
31286
  if (!error) {
31278
31287
  error = err;
31279
31288
  iconMap = result;
31280
31289
  maybePrepare.call(this);
31281
31290
  }
31282
- });
31291
+ }));
31283
31292
  }
31284
31293
  else {
31285
31294
  iconMap = {};
31286
31295
  }
31287
31296
  const patterns = Object.keys(options.patternDependencies);
31288
31297
  if (patterns.length) {
31289
- actor.send('getImages', { icons: patterns, source: this.source, tileID: this.tileID, type: 'patterns' }, (err, result) => {
31298
+ this.inFlightDependencies.push(actor.send('getImages', { icons: patterns, source: this.source, tileID: this.tileID, type: 'patterns' }, (err, result) => {
31299
+ if (dependencySentinel !== this.dependencySentinel) {
31300
+ return;
31301
+ }
31290
31302
  if (!error) {
31291
31303
  error = err;
31292
31304
  patternMap = result;
31293
31305
  maybePrepare.call(this);
31294
31306
  }
31295
- });
31307
+ }));
31296
31308
  }
31297
31309
  else {
31298
31310
  patternMap = {};
@@ -31443,28 +31455,21 @@ class VectorTileWorkerSource {
31443
31455
  * Implements {@link WorkerSource#reloadTile}.
31444
31456
  */
31445
31457
  reloadTile(params, callback) {
31446
- const loaded = this.loaded, uid = params.uid, vtSource = this;
31458
+ const loaded = this.loaded;
31459
+ const uid = params.uid;
31447
31460
  if (loaded && loaded[uid]) {
31448
31461
  const workerTile = loaded[uid];
31449
31462
  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
31463
  if (workerTile.status === 'parsing') {
31459
- workerTile.reloadCallback = done;
31464
+ workerTile.parse(workerTile.vectorTile, this.layerIndex, this.availableImages, this.actor, callback);
31460
31465
  }
31461
31466
  else if (workerTile.status === 'done') {
31462
31467
  // if there was no vector tile data on the initial load, don't try and re-parse tile
31463
31468
  if (workerTile.vectorTile) {
31464
- workerTile.parse(workerTile.vectorTile, this.layerIndex, this.availableImages, this.actor, done);
31469
+ workerTile.parse(workerTile.vectorTile, this.layerIndex, this.availableImages, this.actor, callback);
31465
31470
  }
31466
31471
  else {
31467
- done();
31472
+ callback();
31468
31473
  }
31469
31474
  }
31470
31475
  }
@@ -33711,7 +33716,7 @@ define(['./shared'], (function (performance) { 'use strict';
33711
33716
 
33712
33717
  var name = "maplibre-gl";
33713
33718
  var description = "BSD licensed community fork of mapbox-gl, a WebGL interactive maps library";
33714
- var version$2 = "3.2.0";
33719
+ var version$2 = "3.2.1";
33715
33720
  var main = "dist/maplibre-gl.js";
33716
33721
  var style = "dist/maplibre-gl.css";
33717
33722
  var license = "BSD-3-Clause";
@@ -33730,11 +33735,12 @@ var dependencies = {
33730
33735
  "@mapbox/unitbezier": "^0.0.1",
33731
33736
  "@mapbox/vector-tile": "^1.3.1",
33732
33737
  "@mapbox/whoots-js": "^3.1.0",
33733
- "@maplibre/maplibre-gl-style-spec": "^19.2.1",
33738
+ "@maplibre/maplibre-gl-style-spec": "^19.2.2",
33734
33739
  "@types/geojson": "^7946.0.10",
33735
33740
  "@types/mapbox__point-geometry": "^0.1.2",
33736
33741
  "@types/mapbox__vector-tile": "^1.3.0",
33737
33742
  "@types/pbf": "^3.0.2",
33743
+ "@types/supercluster": "^7.1.0",
33738
33744
  earcut: "^2.2.4",
33739
33745
  "geojson-vt": "^3.2.1",
33740
33746
  "gl-matrix": "^3.4.3",
@@ -33751,7 +33757,7 @@ var dependencies = {
33751
33757
  var devDependencies = {
33752
33758
  "@mapbox/mapbox-gl-rtl-text": "^0.2.3",
33753
33759
  "@mapbox/mvt-fixtures": "^3.10.0",
33754
- "@rollup/plugin-commonjs": "^25.0.2",
33760
+ "@rollup/plugin-commonjs": "^25.0.3",
33755
33761
  "@rollup/plugin-json": "^6.0.0",
33756
33762
  "@rollup/plugin-node-resolve": "^15.1.0",
33757
33763
  "@rollup/plugin-replace": "^5.0.2",
@@ -33763,49 +33769,48 @@ var devDependencies = {
33763
33769
  "@types/d3": "^7.4.0",
33764
33770
  "@types/diff": "^5.0.3",
33765
33771
  "@types/earcut": "^2.1.1",
33766
- "@types/eslint": "^8.40.2",
33772
+ "@types/eslint": "^8.44.0",
33767
33773
  "@types/gl": "^6.0.2",
33768
33774
  "@types/glob": "^8.1.0",
33769
- "@types/jest": "^29.5.2",
33775
+ "@types/jest": "^29.5.3",
33770
33776
  "@types/jsdom": "^21.1.1",
33771
33777
  "@types/minimist": "^1.2.2",
33772
33778
  "@types/murmurhash-js": "^1.0.4",
33773
33779
  "@types/nise": "^1.4.1",
33774
- "@types/node": "^20.3.3",
33780
+ "@types/node": "^20.4.4",
33775
33781
  "@types/offscreencanvas": "^2019.7.0",
33776
33782
  "@types/pixelmatch": "^5.2.4",
33777
33783
  "@types/pngjs": "^6.0.1",
33778
- "@types/react": "^18.2.14",
33779
- "@types/react-dom": "^18.2.6",
33784
+ "@types/react": "^18.2.15",
33785
+ "@types/react-dom": "^18.2.7",
33780
33786
  "@types/request": "^2.48.8",
33781
33787
  "@types/shuffle-seed": "^1.1.0",
33782
- "@types/supercluster": "^7.1.0",
33783
33788
  "@types/window-or-global": "^1.0.4",
33784
- "@typescript-eslint/eslint-plugin": "^5.60.1",
33785
- "@typescript-eslint/parser": "^5.60.1",
33789
+ "@typescript-eslint/eslint-plugin": "^5.61.0",
33790
+ "@typescript-eslint/parser": "^5.62.0",
33786
33791
  address: "^1.2.2",
33787
33792
  benchmark: "^2.1.4",
33788
33793
  canvas: "^2.11.2",
33789
33794
  cssnano: "^6.0.1",
33790
33795
  d3: "^7.8.5",
33791
33796
  "d3-queue": "^3.0.7",
33792
- "devtools-protocol": "^0.0.1165014",
33797
+ "devtools-protocol": "^0.0.1170846",
33793
33798
  diff: "^5.1.0",
33794
33799
  "dts-bundle-generator": "^8.0.1",
33795
- eslint: "^8.44.0",
33800
+ eslint: "^8.45.0",
33796
33801
  "eslint-config-mourner": "^3.0.0",
33797
33802
  "eslint-plugin-html": "^7.1.0",
33798
33803
  "eslint-plugin-import": "^2.27.5",
33799
- "eslint-plugin-jest": "^27.2.2",
33804
+ "eslint-plugin-jest": "^27.2.3",
33800
33805
  "eslint-plugin-tsdoc": "0.2.17",
33801
- "eslint-plugin-react": "^7.32.2",
33806
+ "eslint-plugin-react": "^7.33.0",
33802
33807
  expect: "^29.5.0",
33803
33808
  gl: "^6.0.2",
33804
- glob: "^10.3.1",
33809
+ glob: "^10.3.3",
33805
33810
  "is-builtin-module": "^3.2.1",
33806
- jest: "^29.5.0",
33811
+ jest: "^29.6.1",
33807
33812
  "jest-canvas-mock": "^2.5.2",
33808
- "jest-environment-jsdom": "^29.5.0",
33813
+ "jest-environment-jsdom": "^29.6.1",
33809
33814
  jsdom: "^22.1.0",
33810
33815
  "json-stringify-pretty-compact": "^4.0.0",
33811
33816
  minimist: "^1.2.8",
@@ -33817,22 +33822,22 @@ var devDependencies = {
33817
33822
  "pdf-merger-js": "^4.3.0",
33818
33823
  pixelmatch: "^5.3.0",
33819
33824
  pngjs: "^7.0.0",
33820
- postcss: "^8.4.24",
33825
+ postcss: "^8.4.26",
33821
33826
  "postcss-cli": "^10.1.0",
33822
33827
  "postcss-inline-svg": "^6.0.0",
33823
- "pretty-bytes": "^6.1.0",
33824
- puppeteer: "^20.7.4",
33828
+ "pretty-bytes": "^6.1.1",
33829
+ puppeteer: "^20.9.0",
33825
33830
  react: "^18.2.0",
33826
33831
  "react-dom": "^18.2.0",
33827
- rollup: "^3.26.0",
33832
+ rollup: "^3.26.3",
33828
33833
  "rollup-plugin-sourcemaps": "^0.6.3",
33829
33834
  rw: "^1.3.3",
33830
- semver: "^7.5.3",
33835
+ semver: "^7.5.4",
33831
33836
  "shuffle-seed": "^1.1.6",
33832
33837
  "source-map-explorer": "^2.5.3",
33833
33838
  st: "^3.0.0",
33834
- stylelint: "^15.10.1",
33835
- "stylelint-config-standard": "^33.0.0",
33839
+ stylelint: "^15.10.2",
33840
+ "stylelint-config-standard": "^34.0.0",
33836
33841
  "ts-jest": "^29.1.1",
33837
33842
  "ts-node": "^10.9.1",
33838
33843
  tslib: "^2.6.0",
@@ -36069,16 +36074,6 @@ class RasterDEMTileSource extends RasterTileSource {
36069
36074
  this._options = performance.extend({ type: 'raster-dem' }, options);
36070
36075
  this.encoding = options.encoding || 'mapbox';
36071
36076
  }
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
36077
  loadTile(tile, callback) {
36083
36078
  const url = tile.tileID.canonical.url(this.tiles, this.map.getPixelRatio(), this.scheme);
36084
36079
  tile.request = ImageRequest.getImage(this.map._requestManager.transformRequest(url, ResourceType.Tile), imageLoaded.bind(this), this.map._refreshExpiredTiles);
@@ -42923,7 +42918,7 @@ function getTokenizedAttributesAndUniforms(array) {
42923
42918
  * A webgl program to execute in the GPU space
42924
42919
  */
42925
42920
  class Program {
42926
- constructor(context, name, source, configuration, fixedUniforms, showOverdrawInspector, terrain) {
42921
+ constructor(context, source, configuration, fixedUniforms, showOverdrawInspector, terrain) {
42927
42922
  const gl = context.gl;
42928
42923
  this.program = gl.createProgram();
42929
42924
  const staticAttrInfo = getTokenizedAttributesAndUniforms(source.staticAttributes);
@@ -46198,7 +46193,7 @@ class Painter {
46198
46193
  (this._showOverdrawInspector ? '/overdraw' : '') +
46199
46194
  (this.style.map.terrain ? '/terrain' : '');
46200
46195
  if (!this.cache[key]) {
46201
- this.cache[key] = new Program(this.context, name, shaders[name], programConfiguration, programUniforms[name], this._showOverdrawInspector, this.style.map.terrain);
46196
+ this.cache[key] = new Program(this.context, shaders[name], programConfiguration, programUniforms[name], this._showOverdrawInspector, this.style.map.terrain);
46202
46197
  }
46203
46198
  return this.cache[key];
46204
46199
  }
@@ -46452,7 +46447,6 @@ class Transform {
46452
46447
  constructor(minZoom, maxZoom, minPitch, maxPitch, renderWorldCopies) {
46453
46448
  this.tileSize = 512; // constant
46454
46449
  this.maxValidLatitude = 85.051129; // constant
46455
- this.freezeElevation = false;
46456
46450
  this._renderWorldCopies = renderWorldCopies === undefined ? true : !!renderWorldCopies;
46457
46451
  this._minZoom = minZoom || 0;
46458
46452
  this._maxZoom = maxZoom || 22;
@@ -46471,6 +46465,7 @@ class Transform {
46471
46465
  this._edgeInsets = new EdgeInsets();
46472
46466
  this._posMatrixCache = {};
46473
46467
  this._alignedPosMatrixCache = {};
46468
+ this._minEleveationForCurrentTile = 0;
46474
46469
  }
46475
46470
  clone() {
46476
46471
  const clone = new Transform(this._minZoom, this._maxZoom, this._minPitch, this.maxPitch, this._renderWorldCopies);
@@ -46484,6 +46479,7 @@ class Transform {
46484
46479
  this.height = that.height;
46485
46480
  this._center = that._center;
46486
46481
  this._elevation = that._elevation;
46482
+ this._minEleveationForCurrentTile = that._minEleveationForCurrentTile;
46487
46483
  this.zoom = that.zoom;
46488
46484
  this.angle = that.angle;
46489
46485
  this._fov = that._fov;
@@ -46795,29 +46791,6 @@ class Transform {
46795
46791
  return new performance.MercatorCoordinate(point.x / this.worldSize, point.y / this.worldSize).toLngLat();
46796
46792
  }
46797
46793
  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
46794
  /**
46822
46795
  * get the camera position in LngLat and altitudes in meter
46823
46796
  * @returns An object with lngLat & altitude.
@@ -46836,7 +46809,7 @@ class Transform {
46836
46809
  recalculateZoom(terrain) {
46837
46810
  // find position the camera is looking on
46838
46811
  const center = this.pointLocation(this.centerPoint, terrain);
46839
- const elevation = this.getElevation(center, terrain);
46812
+ const elevation = terrain.getElevationForLngLatZoom(center, this.tileZoom);
46840
46813
  const deltaElevation = this.elevation - elevation;
46841
46814
  if (!deltaElevation)
46842
46815
  return;
@@ -46871,7 +46844,7 @@ class Transform {
46871
46844
  */
46872
46845
  locationPoint(lnglat, terrain) {
46873
46846
  return terrain ?
46874
- this.coordinatePoint(this.locationCoordinate(lnglat), this.getElevation(lnglat, terrain), this.pixelMatrix3D) :
46847
+ this.coordinatePoint(this.locationCoordinate(lnglat), terrain.getElevationForLngLatZoom(lnglat, this.tileZoom), this.pixelMatrix3D) :
46875
46848
  this.coordinatePoint(this.locationCoordinate(lnglat));
46876
46849
  }
46877
46850
  /**
@@ -47091,9 +47064,11 @@ class Transform {
47091
47064
  performance.scale(m, m, [2 / this.width, 2 / this.height, 1]);
47092
47065
  this.glCoordMatrix = m;
47093
47066
  // 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;
47067
+ const cameraToSeaLevelDistance = this.cameraToCenterDistance + this._elevation * this._pixelPerMeter / Math.cos(this._pitch);
47068
+ // In case of negative minimum elevation (e.g. the dead see, under the sea maps) use a lower plane for calculation
47069
+ const minElevation = Math.min(this.elevation, this._minEleveationForCurrentTile);
47070
+ const cameraToLowestPointDistance = cameraToSeaLevelDistance - minElevation * this._pixelPerMeter / Math.cos(this._pitch);
47071
+ const lowestPlane = minElevation < 0 ? cameraToLowestPointDistance : cameraToSeaLevelDistance;
47097
47072
  // Find the distance from the center point [width/2 + offset.x, height/2 + offset.y] to the
47098
47073
  // center top point [width/2 + offset.x, 0] in Z units, using the law of sines.
47099
47074
  // 1 Z unit is equivalent to 1 horizontal px at the center of the map
@@ -49775,10 +49750,10 @@ class HandlerManager {
49775
49750
  (combinedEventsInProgress.drag || combinedEventsInProgress.zoom)) {
49776
49751
  // When starting to drag or move, flag it and register moveend to clear flagging
49777
49752
  this._terrainMovement = true;
49778
- tr.freezeElevation = true;
49753
+ this._map._elevationFreeze = true;
49779
49754
  tr.setLocationAtPoint(loc, around);
49780
49755
  this._map.once('moveend', () => {
49781
- tr.freezeElevation = false;
49756
+ this._map._elevationFreeze = false;
49782
49757
  this._terrainMovement = false;
49783
49758
  tr.recalculateZoom(map.terrain);
49784
49759
  });
@@ -49912,10 +49887,10 @@ class Camera extends performance.Evented {
49912
49887
  /**
49913
49888
  * Sets the map's geographical centerpoint. Equivalent to `jumpTo({center: center})`.
49914
49889
  *
49890
+ * Triggers the following events: `movestart` and `moveend`.
49891
+ *
49915
49892
  * @param center - The centerpoint to set.
49916
49893
  * @param eventData - Additional properties to be added to event objects of events triggered by this method.
49917
- * @event `movestart`
49918
- * @event `moveend`
49919
49894
  * @returns `this`
49920
49895
  * @example
49921
49896
  * ```ts
@@ -49928,11 +49903,11 @@ class Camera extends performance.Evented {
49928
49903
  /**
49929
49904
  * Pans the map by the specified offset.
49930
49905
  *
49906
+ * Triggers the following events: `movestart` and `moveend`.
49907
+ *
49931
49908
  * @param offset - `x` and `y` coordinates by which to pan the map.
49932
49909
  * @param options - Options object
49933
49910
  * @param eventData - Additional properties to be added to event objects of events triggered by this method.
49934
- * @event `movestart`
49935
- * @event `moveend`
49936
49911
  * @returns `this`
49937
49912
  * @see [Navigate the map with game-like controls](https://maplibre.org/maplibre-gl-js/docs/examples/game-controls/)
49938
49913
  */
@@ -49943,11 +49918,11 @@ class Camera extends performance.Evented {
49943
49918
  /**
49944
49919
  * Pans the map to the specified location with an animated transition.
49945
49920
  *
49921
+ * Triggers the following events: `movestart` and `moveend`.
49922
+ *
49946
49923
  * @param lnglat - The location to pan the map to.
49947
49924
  * @param options - Options describing the destination and animation of the transition.
49948
49925
  * @param eventData - Additional properties to be added to event objects of events triggered by this method.
49949
- * @event `movestart`
49950
- * @event `moveend`
49951
49926
  * @returns `this`
49952
49927
  * @example
49953
49928
  * ```ts
@@ -49975,14 +49950,10 @@ class Camera extends performance.Evented {
49975
49950
  /**
49976
49951
  * Sets the map's zoom level. Equivalent to `jumpTo({zoom: zoom})`.
49977
49952
  *
49953
+ * Triggers the following events: `movestart`, `move`, `moveend`, `zoomstart`, `zoom`, and `zoomend`.
49954
+ *
49978
49955
  * @param zoom - The zoom level to set (0-20).
49979
49956
  * @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
49957
  * @returns `this`
49987
49958
  * @example
49988
49959
  * Zoom to the zoom level 5 without an animated transition
@@ -49997,15 +49968,11 @@ class Camera extends performance.Evented {
49997
49968
  /**
49998
49969
  * Zooms the map to the specified zoom level, with an animated transition.
49999
49970
  *
49971
+ * Triggers the following events: `movestart`, `move`, `moveend`, `zoomstart`, `zoom`, and `zoomend`.
49972
+ *
50000
49973
  * @param zoom - The zoom level to transition to.
50001
49974
  * @param options - Options object
50002
49975
  * @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
49976
  * @returns `this`
50010
49977
  * @example
50011
49978
  * ```ts
@@ -50026,14 +49993,10 @@ class Camera extends performance.Evented {
50026
49993
  /**
50027
49994
  * Increases the map's zoom level by 1.
50028
49995
  *
49996
+ * Triggers the following events: `movestart`, `move`, `moveend`, `zoomstart`, `zoom`, and `zoomend`.
49997
+ *
50029
49998
  * @param options - Options object
50030
49999
  * @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
50000
  * @returns `this`
50038
50001
  * @example
50039
50002
  * Zoom the map in one level with a custom animation duration
@@ -50048,14 +50011,10 @@ class Camera extends performance.Evented {
50048
50011
  /**
50049
50012
  * Decreases the map's zoom level by 1.
50050
50013
  *
50014
+ * Triggers the following events: `movestart`, `move`, `moveend`, `zoomstart`, `zoom`, and `zoomend`.
50015
+ *
50051
50016
  * @param options - Options object
50052
50017
  * @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
50018
  * @returns `this`
50060
50019
  * @example
50061
50020
  * Zoom the map out one level with a custom animation offset
@@ -50081,10 +50040,10 @@ class Camera extends performance.Evented {
50081
50040
  *
50082
50041
  * Equivalent to `jumpTo({bearing: bearing})`.
50083
50042
  *
50043
+ * Triggers the following events: `movestart`, `moveend`, and `rotate`.
50044
+ *
50084
50045
  * @param bearing - The desired bearing.
50085
50046
  * @param eventData - Additional properties to be added to event objects of events triggered by this method.
50086
- * @event `movestart`
50087
- * @event `moveend`
50088
50047
  * @returns `this`
50089
50048
  * @example
50090
50049
  * Rotate the map to 90 degrees
@@ -50107,10 +50066,10 @@ class Camera extends performance.Evented {
50107
50066
  *
50108
50067
  * Equivalent to `jumpTo({padding: padding})`.
50109
50068
  *
50069
+ * Triggers the following events: `movestart` and `moveend`.
50070
+ *
50110
50071
  * @param padding - The desired padding.
50111
50072
  * @param eventData - Additional properties to be added to event objects of events triggered by this method.
50112
- * @event `movestart`
50113
- * @event `moveend`
50114
50073
  * @returns `this`
50115
50074
  * @example
50116
50075
  * Sets a left padding of 300px, and a top padding of 50px
@@ -50126,11 +50085,11 @@ class Camera extends performance.Evented {
50126
50085
  * Rotates the map to the specified bearing, with an animated transition. The bearing is the compass direction
50127
50086
  * that is "up"; for example, a bearing of 90° orients the map so that east is up.
50128
50087
  *
50088
+ * Triggers the following events: `movestart`, `moveend`, and `rotate`.
50089
+ *
50129
50090
  * @param bearing - The desired bearing.
50130
50091
  * @param options - Options object
50131
50092
  * @param eventData - Additional properties to be added to event objects of events triggered by this method.
50132
- * @event `movestart`
50133
- * @event `moveend`
50134
50093
  * @returns `this`
50135
50094
  */
50136
50095
  rotateTo(bearing, options, eventData) {
@@ -50141,10 +50100,10 @@ class Camera extends performance.Evented {
50141
50100
  /**
50142
50101
  * Rotates the map so that north is up (0° bearing), with an animated transition.
50143
50102
  *
50103
+ * Triggers the following events: `movestart`, `moveend`, and `rotate`.
50104
+ *
50144
50105
  * @param options - Options object
50145
50106
  * @param eventData - Additional properties to be added to event objects of events triggered by this method.
50146
- * @event `movestart`
50147
- * @event `moveend`
50148
50107
  * @returns `this`
50149
50108
  */
50150
50109
  resetNorth(options, eventData) {
@@ -50154,10 +50113,10 @@ class Camera extends performance.Evented {
50154
50113
  /**
50155
50114
  * Rotates and pitches the map so that north is up (0° bearing) and pitch is 0°, with an animated transition.
50156
50115
  *
50116
+ * Triggers the following events: `movestart`, `move`, `moveend`, `pitchstart`, `pitch`, `pitchend`, and `rotate`.
50117
+ *
50157
50118
  * @param options - Options object
50158
50119
  * @param eventData - Additional properties to be added to event objects of events triggered by this method.
50159
- * @event `movestart`
50160
- * @event `moveend`
50161
50120
  * @returns `this`
50162
50121
  */
50163
50122
  resetNorthPitch(options, eventData) {
@@ -50172,10 +50131,10 @@ class Camera extends performance.Evented {
50172
50131
  * Snaps the map so that north is up (0° bearing), if the current bearing is close enough to it (i.e. within the
50173
50132
  * `bearingSnap` threshold).
50174
50133
  *
50134
+ * Triggers the following events: `movestart`, `moveend`, and `rotate`.
50135
+ *
50175
50136
  * @param options - Options object
50176
50137
  * @param eventData - Additional properties to be added to event objects of events triggered by this method.
50177
- * @event `movestart`
50178
- * @event `moveend`
50179
50138
  * @returns `this`
50180
50139
  */
50181
50140
  snapToNorth(options, eventData) {
@@ -50193,11 +50152,10 @@ class Camera extends performance.Evented {
50193
50152
  /**
50194
50153
  * Sets the map's pitch (tilt). Equivalent to `jumpTo({pitch: pitch})`.
50195
50154
  *
50155
+ * Triggers the following events: `movestart`, `moveend`, `pitchstart`, and `pitchend`.
50156
+ *
50196
50157
  * @param pitch - The pitch to set, measured in degrees away from the plane of the screen (0-60).
50197
50158
  * @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
50159
  * @returns `this`
50202
50160
  */
50203
50161
  setPitch(pitch, eventData) {
@@ -50305,12 +50263,12 @@ class Camera extends performance.Evented {
50305
50263
  * Pans and zooms the map to contain its visible area within the specified geographical bounds.
50306
50264
  * This function will also reset the map's bearing to 0 if bearing is nonzero.
50307
50265
  *
50266
+ * Triggers the following events: `movestart` and `moveend`.
50267
+ *
50308
50268
  * @param bounds - Center these bounds in the viewport and use the highest
50309
50269
  * zoom level up to and including `Map#getMaxZoom()` that fits them in the viewport.
50310
50270
  * @param options- Options supports all properties from {@link AnimationOptions} and {@link CameraOptions} in addition to the fields below.
50311
50271
  * @param eventData - Additional properties to be added to event objects of events triggered by this method.
50312
- * @event `movestart`
50313
- * @event `moveend`
50314
50272
  * @returns `this`
50315
50273
  * @example
50316
50274
  * ```ts
@@ -50329,13 +50287,13 @@ class Camera extends performance.Evented {
50329
50287
  * once the map is rotated to the specified bearing. To zoom without rotating,
50330
50288
  * pass in the current map bearing.
50331
50289
  *
50290
+ * Triggers the following events: `movestart`, `move`, `moveend`, `zoomstart`, `zoom`, `zoomend` and `rotate`.
50291
+ *
50332
50292
  * @param p0 - First point on screen, in pixel coordinates
50333
50293
  * @param p1 - Second point on screen, in pixel coordinates
50334
50294
  * @param bearing - Desired map bearing at end of animation, in degrees
50335
50295
  * @param options - Options object
50336
50296
  * @param eventData - Additional properties to be added to event objects of events triggered by this method.
50337
- * @event `movestart`
50338
- * @event `moveend`
50339
50297
  * @returns `this`
50340
50298
  * @example
50341
50299
  * ```ts
@@ -50366,18 +50324,11 @@ class Camera extends performance.Evented {
50366
50324
  * an animated transition. The map will retain its current values for any
50367
50325
  * details not specified in `options`.
50368
50326
  *
50327
+ * Triggers the following events: `movestart`, `move`, `moveend`, `zoomstart`, `zoom`, `zoomend`, `pitchstart`,
50328
+ * `pitch`, `pitchend`, and `rotate`.
50329
+ *
50369
50330
  * @param options - Options object
50370
50331
  * @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
50332
  * @returns `this`
50382
50333
  * @example
50383
50334
  * ```ts
@@ -50475,19 +50426,12 @@ class Camera extends performance.Evented {
50475
50426
  * the `reduced motion` accessibility feature enabled in their operating system,
50476
50427
  * unless `options` includes `essential: true`.
50477
50428
  *
50429
+ * Triggers the following events: `movestart`, `move`, `moveend`, `zoomstart`, `zoom`, `zoomend`, `pitchstart`,
50430
+ * `pitch`, `pitchend`, and `rotate`.
50431
+ *
50478
50432
  * @param options - Options describing the destination and animation of the transition.
50479
50433
  * Accepts {@link CameraOptions} and {@link AnimationOptions}.
50480
50434
  * @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
50435
  * @returns `this`
50492
50436
  * @see [Navigate the map with game-like controls](https://maplibre.org/maplibre-gl-js/docs/examples/game-controls/)
50493
50437
  */
@@ -50585,11 +50529,12 @@ class Camera extends performance.Evented {
50585
50529
  _prepareElevation(center) {
50586
50530
  this._elevationCenter = center;
50587
50531
  this._elevationStart = this.transform.elevation;
50588
- this._elevationTarget = this.transform.getElevation(center, this.terrain);
50589
- this.transform.freezeElevation = true;
50532
+ this._elevationTarget = this.terrain.getElevationForLngLatZoom(center, this.transform.tileZoom);
50533
+ this._elevationFreeze = true;
50590
50534
  }
50591
50535
  _updateElevation(k) {
50592
- const elevation = this.transform.getElevation(this._elevationCenter, this.terrain);
50536
+ this.transform._minEleveationForCurrentTile = this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter, this.transform.tileZoom);
50537
+ const elevation = this.terrain.getElevationForLngLatZoom(this._elevationCenter, this.transform.tileZoom);
50593
50538
  // target terrain updated during flight, slowly move camera to new height
50594
50539
  if (k < 1 && elevation !== this._elevationTarget) {
50595
50540
  const pitch1 = this._elevationTarget - this._elevationStart;
@@ -50600,7 +50545,7 @@ class Camera extends performance.Evented {
50600
50545
  this.transform.elevation = performance.interpolate.number(this._elevationStart, this._elevationTarget, k);
50601
50546
  }
50602
50547
  _finalizeElevation() {
50603
- this.transform.freezeElevation = false;
50548
+ this._elevationFreeze = false;
50604
50549
  this.transform.recalculateZoom(this.terrain);
50605
50550
  }
50606
50551
  /**
@@ -50608,6 +50553,7 @@ class Camera extends performance.Evented {
50608
50553
  * If `transformCameraUpdate` is specified, a copy of the current transform is created to track the accumulated changes.
50609
50554
  * This underlying transform represents the "desired state" proposed by input handlers / animations / UI controls.
50610
50555
  * It may differ from the state used for rendering (`this.transform`).
50556
+ * @hidden
50611
50557
  * @returns Transform to apply changes to
50612
50558
  */
50613
50559
  _getTransformForUpdate() {
@@ -50620,6 +50566,7 @@ class Camera extends performance.Evented {
50620
50566
  }
50621
50567
  /**
50622
50568
  * Called after the camera is done being manipulated.
50569
+ * @hidden
50623
50570
  * @param tr - the requested camera end state
50624
50571
  * Call `transformCameraUpdate` if present, and then apply the "approved" changes.
50625
50572
  */
@@ -50687,20 +50634,13 @@ class Camera extends performance.Evented {
50687
50634
  * if the user has the `reduced motion` accessibility feature enabled in their operating system,
50688
50635
  * unless 'options' includes `essential: true`.
50689
50636
  *
50637
+ * Triggers the following events: `movestart`, `move`, `moveend`, `zoomstart`, `zoom`, `zoomend`, `pitchstart`,
50638
+ * `pitch`, `pitchend`, and `rotate`.
50639
+ *
50690
50640
  * @param options - Options describing the destination and animation of the transition.
50691
50641
  * Accepts {@link CameraOptions}, {@link AnimationOptions},
50692
50642
  * and the following additional options.
50693
50643
  * @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
50644
  * @returns `this`
50705
50645
  * @example
50706
50646
  * ```ts
@@ -50929,9 +50869,9 @@ class Camera extends performance.Evented {
50929
50869
  if (!this.terrain) {
50930
50870
  return null;
50931
50871
  }
50932
- const elevation = this.transform.getElevation(performance.LngLat.convert(lngLatLike), this.terrain);
50872
+ const elevation = this.terrain.getElevationForLngLatZoom(performance.LngLat.convert(lngLatLike), this.transform.tileZoom);
50933
50873
  /**
50934
- * Different zoomlevels with different terrain-tiles the elvation-values are not the same.
50874
+ * Different zoomlevels with different terrain-tiles the elevation-values are not the same.
50935
50875
  * map.transform.elevation variable with the center-altitude.
50936
50876
  * In maplibre the proj-matrix is translated by this value in negative z-direction.
50937
50877
  * So we need to add this value to the elevation to get the correct value.
@@ -51451,7 +51391,17 @@ class Terrain {
51451
51391
  dem.get(cx + 1, cy + 1) * (tx) * (ty));
51452
51392
  }
51453
51393
  /**
51454
- * get the Elevation for given coordinate in respect of exaggeration.
51394
+ * Get the elevation for given {@link LngLat} in respect of exaggeration.
51395
+ * @param lnglat - the location
51396
+ * @param zoom - the zoom
51397
+ * @returns the elevation
51398
+ */
51399
+ getElevationForLngLatZoom(lnglat, zoom) {
51400
+ const { tileID, mercatorX, mercatorY } = this._getOverscaledTileIDFromLngLatZoom(lnglat, zoom);
51401
+ return this.getElevation(tileID, mercatorX % performance.EXTENT, mercatorY % performance.EXTENT, performance.EXTENT);
51402
+ }
51403
+ /**
51404
+ * Get the elevation for given coordinate in respect of exaggeration.
51455
51405
  * @param tileID - the tile id
51456
51406
  * @param x - between 0 .. EXTENT
51457
51407
  * @param y - between 0 .. EXTENT
@@ -51665,6 +51615,11 @@ class Terrain {
51665
51615
  // divide by 5 is evaluated by trial & error to get a frame in the right height
51666
51616
  return 2 * Math.PI * performance.earthRadius / Math.pow(2, zoom) / 5;
51667
51617
  }
51618
+ getMinTileElevationForLngLatZoom(lnglat, zoom) {
51619
+ var _a;
51620
+ const { tileID } = this._getOverscaledTileIDFromLngLatZoom(lnglat, zoom);
51621
+ return (_a = this.getMinMaxElevation(tileID).minElevation) !== null && _a !== void 0 ? _a : 0;
51622
+ }
51668
51623
  /**
51669
51624
  * Get the minimum and maximum elevation contained in a tile. This includes any
51670
51625
  * exaggeration included in the terrain.
@@ -51682,6 +51637,19 @@ class Terrain {
51682
51637
  }
51683
51638
  return minMax;
51684
51639
  }
51640
+ _getOverscaledTileIDFromLngLatZoom(lnglat, zoom) {
51641
+ const mercatorCoordinate = performance.MercatorCoordinate.fromLngLat(lnglat.wrap());
51642
+ const worldSize = (1 << zoom) * performance.EXTENT;
51643
+ const mercatorX = mercatorCoordinate.x * worldSize;
51644
+ const mercatorY = mercatorCoordinate.y * worldSize;
51645
+ const tileX = Math.floor(mercatorX / performance.EXTENT), tileY = Math.floor(mercatorY / performance.EXTENT);
51646
+ const tileID = new performance.OverscaledTileID(zoom, 0, zoom, tileX, tileY);
51647
+ return {
51648
+ tileID,
51649
+ mercatorX,
51650
+ mercatorY
51651
+ };
51652
+ }
51685
51653
  }
51686
51654
 
51687
51655
  /**
@@ -51934,7 +51902,7 @@ const defaultOptions$4 = {
51934
51902
  fadeDuration: 300,
51935
51903
  crossSourceCollisions: true,
51936
51904
  validateStyle: true,
51937
- /** Because GL MAX_TEXTURE_SIZE is usually at least 4096px. */
51905
+ /**Because GL MAX_TEXTURE_SIZE is usually at least 4096px. */
51938
51906
  maxCanvasSize: [4096, 4096]
51939
51907
  };
51940
51908
  /**
@@ -52125,6 +52093,7 @@ let Map$1 = class Map extends Camera {
52125
52093
  /**
52126
52094
  * Returns a unique number for this map instance which is used for the MapLoadEvent
52127
52095
  * to make sure we only fire one event per instantiated map object.
52096
+ * @hidden
52128
52097
  * @returns the uniq map ID
52129
52098
  */
52130
52099
  _getMapId() {
@@ -52133,6 +52102,8 @@ let Map$1 = class Map extends Camera {
52133
52102
  /**
52134
52103
  * Adds an {@link IControl} to the map, calling `control.onAdd(this)`.
52135
52104
  *
52105
+ * An {@link ErrorEvent} will be fired if the image parameter is invald.
52106
+ *
52136
52107
  * @param control - The {@link IControl} to add.
52137
52108
  * @param position - position on the map to which the control will be added.
52138
52109
  * Valid values are `'top-left'`, `'top-right'`, `'bottom-left'`, and `'bottom-right'`. Defaults to `'top-right'`.
@@ -52170,6 +52141,8 @@ let Map$1 = class Map extends Camera {
52170
52141
  /**
52171
52142
  * Removes the control from the map.
52172
52143
  *
52144
+ * An {@link ErrorEvent} will be fired if the image parameter is invald.
52145
+ *
52173
52146
  * @param control - The {@link IControl} to remove.
52174
52147
  * @returns `this`
52175
52148
  * @example
@@ -52212,7 +52185,7 @@ let Map$1 = class Map extends Camera {
52212
52185
  }
52213
52186
  calculateCameraOptionsFromTo(from, altitudeFrom, to, altitudeTo) {
52214
52187
  if (altitudeTo == null && this.terrain) {
52215
- altitudeTo = this.transform.getElevation(to, this.terrain);
52188
+ altitudeTo = this.terrain.getElevationForLngLatZoom(to, this.transform.tileZoom);
52216
52189
  }
52217
52190
  return super.calculateCameraOptionsFromTo(from, altitudeFrom, to, altitudeTo);
52218
52191
  }
@@ -52224,6 +52197,8 @@ let Map$1 = class Map extends Camera {
52224
52197
  * This method must be called after the map's `container` is resized programmatically
52225
52198
  * or when the map is shown after being initially hidden with CSS.
52226
52199
  *
52200
+ * Triggers the following events: `movestart`, `move`, `moveend`, and `resize`.
52201
+ *
52227
52202
  * @param eventData - Additional properties to be passed to `movestart`, `move`, `resize`, and `moveend`
52228
52203
  * events that get triggered as a result of resize. This can be useful for differentiating the
52229
52204
  * source of an event (for example, user-initiated or programmatically-triggered events).
@@ -52265,9 +52240,10 @@ let Map$1 = class Map extends Camera {
52265
52240
  this.fire(new performance.Event('moveend', eventData));
52266
52241
  return this;
52267
52242
  }
52268
- /*
52243
+ /**
52269
52244
  * Return the map's pixel ratio eventually scaled down to respect maxCanvasSize.
52270
52245
  * Internally you should use this and not getPixelRatio().
52246
+ * @hidden
52271
52247
  */
52272
52248
  _getClampedPixelRatio(width, height) {
52273
52249
  const { 0: maxCanvasWidth, 1: maxCanvasHeight } = this._maxCanvasSize;
@@ -52358,6 +52334,8 @@ let Map$1 = class Map extends Camera {
52358
52334
  * if the map is 512px tall it will not be possible to zoom below zoom 0
52359
52335
  * no matter what the `minZoom` is set to.
52360
52336
  *
52337
+ * A {@link ErrorEvent} event will be fired if minZoom is out of bounds.
52338
+ *
52361
52339
  * @param minZoom - The minimum zoom level to set (-2 - 24).
52362
52340
  * If `null` or `undefined` is provided, the function removes the current minimum zoom (i.e. sets it to -2).
52363
52341
  * @returns `this`
@@ -52393,6 +52371,8 @@ let Map$1 = class Map extends Camera {
52393
52371
  * If the map's current zoom level is higher than the new maximum,
52394
52372
  * the map will zoom to the new maximum.
52395
52373
  *
52374
+ * A {@link ErrorEvent} event will be fired if minZoom is out of bounds.
52375
+ *
52396
52376
  * @param maxZoom - The maximum zoom level to set.
52397
52377
  * If `null` or `undefined` is provided, the function removes the current maximum zoom (sets it to 22).
52398
52378
  * @returns `this`
@@ -52428,6 +52408,8 @@ let Map$1 = class Map extends Camera {
52428
52408
  * If the map's current pitch is lower than the new minimum,
52429
52409
  * the map will pitch to the new minimum.
52430
52410
  *
52411
+ * A {@link ErrorEvent} event will be fired if minPitch is out of bounds.
52412
+ *
52431
52413
  * @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
52414
  * If `null` or `undefined` is provided, the function removes the current minimum pitch (i.e. sets it to 0).
52433
52415
  * @returns `this`
@@ -52458,6 +52440,8 @@ let Map$1 = class Map extends Camera {
52458
52440
  * If the map's current pitch is higher than the new maximum,
52459
52441
  * the map will pitch to the new maximum.
52460
52442
  *
52443
+ * A {@link ErrorEvent} event will be fired if maxPitch is out of bounds.
52444
+ *
52461
52445
  * @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
52446
  * If `null` or `undefined` is provided, the function removes the current maximum pitch (sets it to 60).
52463
52447
  * @returns `this`
@@ -52661,13 +52645,6 @@ let Map$1 = class Map extends Camera {
52661
52645
  return { layer: layerId, listener, delegates: { [type]: delegate } };
52662
52646
  }
52663
52647
  }
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
52648
  on(type, layerIdOrListener, listener) {
52672
52649
  if (listener === undefined) {
52673
52650
  return super.on(type, layerIdOrListener);
@@ -53026,11 +53003,14 @@ let Map$1 = class Map extends Camera {
53026
53003
  /**
53027
53004
  * Adds a source to the map's style.
53028
53005
  *
53006
+ * Events triggered:
53007
+ *
53008
+ * Triggers the `source.add` event.
53009
+ *
53029
53010
  * @param id - The ID of the source to add. Must not conflict with existing sources.
53030
53011
  * @param source - The source object, conforming to the
53031
- * MapLibre Style Specification's [source definition](https://maplibre.org/maplibre-style-spec/#sources) or
53012
+ * MapLibre Style Specification's [source definition](https://maplibre.org/maplibre-style-spec/sources) or
53032
53013
  * {@link CanvasSourceSpecification}.
53033
- * @event `source.add`
53034
53014
  * @returns `this`
53035
53015
  * @example
53036
53016
  * ```ts
@@ -53067,6 +53047,8 @@ let Map$1 = class Map extends Camera {
53067
53047
  * Returns a Boolean indicating whether the source is loaded. Returns `true` if the source with
53068
53048
  * the given ID in the map's style has no outstanding network requests, otherwise `false`.
53069
53049
  *
53050
+ * A {@link ErrorEvent} event will be fired if there is no source wit the specified ID.
53051
+ *
53070
53052
  * @param id - The ID of the source to be checked.
53071
53053
  * @returns A Boolean indicating whether the source is loaded.
53072
53054
  * @example
@@ -53084,6 +53066,9 @@ let Map$1 = class Map extends Camera {
53084
53066
  }
53085
53067
  /**
53086
53068
  * Loads a 3D terrain mesh, based on a "raster-dem" source.
53069
+ *
53070
+ * Triggers the `terrain` event.
53071
+ *
53087
53072
  * @param options - Options object.
53088
53073
  * @returns `this`
53089
53074
  * @example
@@ -53104,7 +53089,8 @@ let Map$1 = class Map extends Camera {
53104
53089
  if (this.painter.renderToTexture)
53105
53090
  this.painter.renderToTexture.destruct();
53106
53091
  this.painter.renderToTexture = null;
53107
- this.transform.updateElevation(this.terrain);
53092
+ this.transform._minEleveationForCurrentTile = 0;
53093
+ this.transform.elevation = 0;
53108
53094
  }
53109
53095
  else {
53110
53096
  // add terrain
@@ -53120,14 +53106,17 @@ let Map$1 = class Map extends Camera {
53120
53106
  }
53121
53107
  this.terrain = new Terrain(this.painter, sourceCache, options);
53122
53108
  this.painter.renderToTexture = new RenderToTexture(this.painter, this.terrain);
53123
- this.transform.updateElevation(this.terrain);
53109
+ this.transform._minEleveationForCurrentTile = this.terrain.getMinTileElevationForLngLatZoom(this.transform.center, this.transform.tileZoom);
53110
+ this.transform.elevation = this.terrain.getElevationForLngLatZoom(this.transform.center, this.transform.tileZoom);
53124
53111
  this._terrainDataCallback = e => {
53125
53112
  if (e.dataType === 'style') {
53126
53113
  this.terrain.sourceCache.freeRtt();
53127
53114
  }
53128
53115
  else if (e.dataType === 'source' && e.tile) {
53129
- if (e.sourceId === options.source)
53130
- this.transform.updateElevation(this.terrain);
53116
+ if (e.sourceId === options.source && !this._elevationFreeze) {
53117
+ this.transform._minEleveationForCurrentTile = this.terrain.getMinTileElevationForLngLatZoom(this.transform.center, this.transform.tileZoom);
53118
+ this.transform.elevation = this.terrain.getElevationForLngLatZoom(this.transform.center, this.transform.tileZoom);
53119
+ }
53131
53120
  this.terrain.sourceCache.freeRtt(e.tile.tileID);
53132
53121
  }
53133
53122
  };
@@ -53223,11 +53212,12 @@ let Map$1 = class Map extends Camera {
53223
53212
  /**
53224
53213
  * Add an image to the style. This image can be displayed on the map like any other icon in the style's
53225
53214
  * 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.
53215
+ * [`icon-image`](https://maplibre.org/maplibre-style-spec/layers/#layout-symbol-icon-image),
53216
+ * [`background-pattern`](https://maplibre.org/maplibre-style-spec/layers/#paint-background-background-pattern),
53217
+ * [`fill-pattern`](https://maplibre.org/maplibre-style-spec/layers/#paint-fill-fill-pattern),
53218
+ * or [`line-pattern`](https://maplibre.org/maplibre-style-spec/layers/#paint-line-line-pattern).
53219
+ *
53220
+ * 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
53221
  *
53232
53222
  * @param id - The ID of the image.
53233
53223
  * @param image - The image as an `HTMLImageElement`, `ImageData`, `ImageBitmap` or object with `width`, `height`, and `data`
@@ -53293,10 +53283,12 @@ let Map$1 = class Map extends Camera {
53293
53283
  /**
53294
53284
  * Update an existing image in a style. This image can be displayed on the map like any other icon in the style's
53295
53285
  * 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).
53286
+ * [`icon-image`](https://maplibre.org/maplibre-style-spec/layers/#layout-symbol-icon-image),
53287
+ * [`background-pattern`](https://maplibre.org/maplibre-style-spec/layers/#paint-background-background-pattern),
53288
+ * [`fill-pattern`](https://maplibre.org/maplibre-style-spec/layers/#paint-fill-fill-pattern),
53289
+ * or [`line-pattern`](https://maplibre.org/maplibre-style-spec/layers/#paint-line-line-pattern).
53290
+ *
53291
+ * An {@link ErrorEvent} will be fired if the image parameter is invald.
53300
53292
  *
53301
53293
  * @param id - The ID of the image.
53302
53294
  * @param image - The image as an `HTMLImageElement`, `ImageData`, `ImageBitmap` or object with `width`, `height`, and `data`
@@ -53351,6 +53343,8 @@ let Map$1 = class Map extends Camera {
53351
53343
  * in the style's original sprite and any images
53352
53344
  * that have been added at runtime using {@link Map#addImage}.
53353
53345
  *
53346
+ * An {@link ErrorEvent} will be fired if the image parameter is invald.
53347
+ *
53354
53348
  * @param id - The ID of the image.
53355
53349
  *
53356
53350
  * @returns A Boolean indicating whether the image exists.
@@ -53421,14 +53415,14 @@ let Map$1 = class Map extends Camera {
53421
53415
  return this.style.listImages();
53422
53416
  }
53423
53417
  /**
53424
- * Adds a [MapLibre style layer](https://maplibre.org/maplibre-style-spec/#layers)
53418
+ * Adds a [MapLibre style layer](https://maplibre.org/maplibre-style-spec/layers)
53425
53419
  * to the map's style.
53426
53420
  *
53427
53421
  * 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).
53422
+ * and available paint and layout properties in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/layers).
53429
53423
  *
53430
53424
  * @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,
53425
+ * conforming to either the MapLibre Style Specification's [layer definition](https://maplibre.org/maplibre-style-spec/layers) or,
53432
53426
  * less commonly, the {@link CustomLayerInterface} specification.
53433
53427
  * The MapLibre Style Specification's layer definition is appropriate for most layers.
53434
53428
  *
@@ -53526,10 +53520,9 @@ let Map$1 = class Map extends Camera {
53526
53520
  /**
53527
53521
  * Removes the layer with the given ID from the map's style.
53528
53522
  *
53529
- * If no such layer exists, an `error` event is fired.
53523
+ * An {@link ErrorEvent} will be fired if the image parameter is invald.
53530
53524
  *
53531
53525
  * @param id - The ID of the layer to remove
53532
- * @event `error`
53533
53526
  * @returns `this`
53534
53527
  *
53535
53528
  * @example
@@ -53561,8 +53554,8 @@ let Map$1 = class Map extends Camera {
53561
53554
  }
53562
53555
  /**
53563
53556
  * 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))
53557
+ * [minimum zoom level](https://maplibre.org/maplibre-style-spec/layers/#minzoom)
53558
+ * and [maximum zoom level](https://maplibre.org/maplibre-style-spec/layers/#maxzoom))
53566
53559
  * at which the layer will be rendered.
53567
53560
  *
53568
53561
  * Note: For style layers using vector sources, style layers cannot be rendered at zoom levels lower than the
@@ -53713,12 +53706,11 @@ let Map$1 = class Map extends Camera {
53713
53706
  return this.style.getGlyphsUrl();
53714
53707
  }
53715
53708
  /**
53716
- * Adds a sprite to the map's style.
53709
+ * Adds a sprite to the map's style. Fires the `style` event.
53717
53710
  *
53718
53711
  * @param id - The ID of the sprite to add. Must not conflict with existing sprites.
53719
53712
  * @param url - The URL to load the sprite from
53720
53713
  * @param options - Options object.
53721
- * @event `style`
53722
53714
  * @returns `this`
53723
53715
  * @example
53724
53716
  * ```ts
@@ -53735,10 +53727,9 @@ let Map$1 = class Map extends Camera {
53735
53727
  return this;
53736
53728
  }
53737
53729
  /**
53738
- * Removes the sprite from the map's style.
53730
+ * Removes the sprite from the map's style. Fires the `style` event.
53739
53731
  *
53740
53732
  * @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
53733
  * @returns `this`
53743
53734
  * @example
53744
53735
  * ```ts
@@ -53782,7 +53773,7 @@ let Map$1 = class Map extends Camera {
53782
53773
  /**
53783
53774
  * Sets the any combination of light values.
53784
53775
  *
53785
- * @param light - Light properties to set. Must conform to the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/#light).
53776
+ * @param light - Light properties to set. Must conform to the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/light).
53786
53777
  * @param options - Options object.
53787
53778
  * @returns `this`
53788
53779
  *
@@ -54002,6 +53993,8 @@ let Map$1 = class Map extends Camera {
54002
53993
  <div class="maplibregl-desktop-message">${desktopMessage}</div>
54003
53994
  <div class="maplibregl-mobile-message">${mobileMessage}</div>
54004
53995
  `;
53996
+ // Remove cooperative gesture screen from the accessibility tree since screenreaders cannot interact with the map using gestures
53997
+ this._cooperativeGesturesScreen.setAttribute('aria-hidden', 'true');
54005
53998
  // Add event to canvas container since gesture container is pointer-events: none
54006
53999
  this._canvasContainer.addEventListener('wheel', this._cooperativeGesturesOnWheel, false);
54007
54000
  // Add a cooperative gestures class (enable touch-action: pan-x pan-y;)
@@ -54077,6 +54070,7 @@ let Map$1 = class Map extends Camera {
54077
54070
  /**
54078
54071
  * Update this map's style and sources, and re-render the map.
54079
54072
  *
54073
+ * @hidden
54080
54074
  * @param updateStyle - mark the map's style for reprocessing as
54081
54075
  * well as its sources
54082
54076
  * @returns `this`
@@ -54092,6 +54086,7 @@ let Map$1 = class Map extends Camera {
54092
54086
  /**
54093
54087
  * Request that the given callback be executed during the next render
54094
54088
  * frame. Schedule a render frame if one is not already scheduled.
54089
+ * @hidden
54095
54090
  * @returns An id that can be used to cancel the callback
54096
54091
  */
54097
54092
  _requestRenderFrame(callback) {
@@ -54109,6 +54104,7 @@ let Map$1 = class Map extends Camera {
54109
54104
  * - A transition is in progress
54110
54105
  *
54111
54106
  * @param paintStartTimeStamp - The time when the animation frame began executing.
54107
+ * @hidden
54112
54108
  *
54113
54109
  * @returns `this`
54114
54110
  */
@@ -54151,9 +54147,17 @@ let Map$1 = class Map extends Camera {
54151
54147
  this.style._updateSources(this.transform);
54152
54148
  }
54153
54149
  // update terrain stuff
54154
- if (this.terrain)
54150
+ if (this.terrain) {
54155
54151
  this.terrain.sourceCache.update(this.transform, this.terrain);
54156
- this.transform.updateElevation(this.terrain);
54152
+ this.transform._minEleveationForCurrentTile = this.terrain.getMinTileElevationForLngLatZoom(this.transform.center, this.transform.tileZoom);
54153
+ if (!this._elevationFreeze) {
54154
+ this.transform.elevation = this.terrain.getElevationForLngLatZoom(this.transform.center, this.transform.tileZoom);
54155
+ }
54156
+ }
54157
+ else {
54158
+ this.transform._minEleveationForCurrentTile = 0;
54159
+ this.transform.elevation = 0;
54160
+ }
54157
54161
  this._placementDirty = this.style && this.style._updatePlacement(this.painter.transform, this.showCollisionBoxes, fadeDuration, this._crossSourceCollisions);
54158
54162
  // Actually draw
54159
54163
  this.painter.render(this.style, {