azure-maps-control 2.1.5 → 2.1.9

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.
@@ -43487,7 +43487,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
43487
43487
  return Url;
43488
43488
  }());
43489
43489
 
43490
- var version = "2.1.5";
43490
+ var version = "2.1.9";
43491
43491
 
43492
43492
  /**
43493
43493
  * A helper class that provides methods for getting various forms of the map controls current version.
@@ -43532,7 +43532,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
43532
43532
  if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
43533
43533
  tooltipContent.classList.add('dark');
43534
43534
  }
43535
- window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', function (e) {
43535
+ var themeQuery = window.matchMedia('(prefers-color-scheme: dark)');
43536
+ var onThemeChange = function (e) {
43536
43537
  var isDark = e.matches;
43537
43538
  if (isDark && !tooltipContent.classList.contains('dark')) {
43538
43539
  tooltipContent.classList.add('dark');
@@ -43540,7 +43541,14 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
43540
43541
  else if (!isDark && tooltipContent.classList.contains('dark')) {
43541
43542
  tooltipContent.classList.remove('dark');
43542
43543
  }
43543
- });
43544
+ };
43545
+ // compensate for browsers where MediaQueryList is not derived from EventTarget (pre iOS13 Safari)
43546
+ if (typeof themeQuery.addEventListener === 'function') {
43547
+ themeQuery.addEventListener('change', function (e) { return onThemeChange(e); });
43548
+ }
43549
+ else if (typeof themeQuery.addListener === 'function') {
43550
+ themeQuery.addListener(function (e) { return onThemeChange(e); });
43551
+ }
43544
43552
  return tooltipContent;
43545
43553
  };
43546
43554
  /**
@@ -46839,6 +46847,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
46839
46847
  var styleOpsGrid = this.buildStyleOpsGrid(container);
46840
46848
  var currStyleButton = this.buildCurrStyleBtn(container, styleOpsGrid);
46841
46849
  var tooltip = buildAccessibleTooltip("Select Style");
46850
+ styleOpsGrid.classList.add(options ? options.position || 'top-right' : 'top-right');
46842
46851
  container.addEventListener("mouseover", function () {
46843
46852
  _this.hasMouse = true;
46844
46853
  container.classList.add(StyleControl.Css.inUse);
@@ -46904,6 +46913,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
46904
46913
  if (image.alt !== newAlt) {
46905
46914
  image.alt = newAlt;
46906
46915
  }
46916
+ if (image.parentElement.lastChild instanceof Text) {
46917
+ image.parentElement.lastChild.textContent = newAlt;
46918
+ }
46907
46919
  }
46908
46920
  };
46909
46921
  /**
@@ -46934,15 +46946,21 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
46934
46946
  styleOptionButton.setAttribute("type", "button");
46935
46947
  var styleIconImage = new Image();
46936
46948
  styleIconImage.src = icon;
46937
- styleIconImage.alt = friendlyName;
46949
+ if (this.options.layout === "icons") {
46950
+ styleIconImage.alt = friendlyName;
46951
+ }
46938
46952
  styleOptionButton.appendChild(styleIconImage);
46939
46953
  if (this.options.layout === "icons") {
46940
46954
  styleOptionButton.classList.add(StyleControl.Css.button);
46941
46955
  }
46942
46956
  else {
46957
+ styleOptionButton.classList.add(StyleControl.Css.listButton);
46958
+ styleOptionButton.classList.add(StyleControl.Css.expanded);
46943
46959
  styleOptionButton.appendChild(document.createTextNode(friendlyName));
46944
46960
  }
46945
46961
  styleOptionButton.addEventListener("click", function () {
46962
+ _this.hasMouse = false;
46963
+ _this.hasFocus = false;
46946
46964
  var styleButton = _this.styleButtons[name];
46947
46965
  if (styleButton && !styleButton.hasAttribute("disabled")) {
46948
46966
  _this._invokeEvent("styleselected", name);
@@ -46961,12 +46979,16 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
46961
46979
  return styleOptionButton;
46962
46980
  };
46963
46981
  StyleControl.prototype.buildCurrStyleBtn = function (container, opsGrid) {
46964
- var selectCurrButton = document.createElement("button");
46965
- selectCurrButton.classList.add(StyleControl.Css.button);
46982
+ var selectCurrButton = document.createElement("div");
46983
+ if (this.options.layout == 'icons') {
46984
+ selectCurrButton.classList.add(StyleControl.Css.button);
46985
+ }
46986
+ else {
46987
+ selectCurrButton.classList.add(StyleControl.Css.listButton);
46988
+ }
46966
46989
  selectCurrButton.classList.add(StyleControl.Css.currentStyle);
46967
46990
  selectCurrButton.setAttribute("aria-label", "Select Style");
46968
46991
  selectCurrButton.setAttribute("alt", "Select Style");
46969
- selectCurrButton.setAttribute("type", "button");
46970
46992
  this.currStyleImage = new Image();
46971
46993
  selectCurrButton.appendChild(this.currStyleImage);
46972
46994
  var selectCurrButtonIcon = document.createElement("div");
@@ -46978,7 +47000,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
46978
47000
  var _this = this;
46979
47001
  var styleOpsGrid = document.createElement("div");
46980
47002
  styleOpsGrid.classList.add(StyleControl.Css.styleOptions);
46981
- styleOpsGrid.classList.add(this.options.layout);
47003
+ if (this.options.layout === 'icons') {
47004
+ styleOpsGrid.classList.add(this.options.layout);
47005
+ }
47006
+ else {
47007
+ styleOpsGrid.classList.add(StyleControl.Css.dropdown);
47008
+ }
46982
47009
  styleOpsGrid.setAttribute("aria-label", "Style Options");
46983
47010
  styleOpsGrid.classList.add("hidden-accessible-element");
46984
47011
  // Once the map's style definition is initialized create a map between style names and icons.
@@ -47012,6 +47039,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47012
47039
  if (style.name === currStyle) {
47013
47040
  _this.currStyleImage.src = iconUrl;
47014
47041
  _this.currStyleImage.alt = _this.mapToFriendlyStyleName(style.name);
47042
+ _this.currStyleImage.parentElement.appendChild(document.createTextNode(_this.mapToFriendlyStyleName(style.name)));
47015
47043
  }
47016
47044
  }
47017
47045
  }
@@ -47027,9 +47055,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47027
47055
  var styleOptionButton = _this.buildSelectStyleBtn(styleName, iconUrl);
47028
47056
  styleOpsGrid.appendChild(styleOptionButton);
47029
47057
  _this.styleButtons[styleName] = styleOptionButton;
47030
- var tooltip = buildAccessibleTooltip(_this.mapToFriendlyStyleName(styleName));
47031
- styleOpsGrid.appendChild(tooltip);
47032
- positionTooltip(tooltip, styleOptionButton);
47058
+ if (_this.options.layout === "icons") {
47059
+ var tooltip = buildAccessibleTooltip(_this.mapToFriendlyStyleName(styleName));
47060
+ styleOpsGrid.appendChild(tooltip);
47061
+ positionTooltip(tooltip, styleOptionButton);
47062
+ }
47033
47063
  });
47034
47064
  }
47035
47065
  else {
@@ -47038,9 +47068,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47038
47068
  var styleOptionButton = _this.buildSelectStyleBtn(styleName, iconUrl);
47039
47069
  styleOpsGrid.appendChild(styleOptionButton);
47040
47070
  _this.styleButtons[styleName] = styleOptionButton;
47041
- var tooltip = buildAccessibleTooltip(_this.mapToFriendlyStyleName(styleName));
47042
- styleOpsGrid.appendChild(tooltip);
47043
- positionTooltip(tooltip, styleOptionButton);
47071
+ if (_this.options.layout === "icons") {
47072
+ var tooltip = buildAccessibleTooltip(_this.mapToFriendlyStyleName(styleName));
47073
+ styleOpsGrid.appendChild(tooltip);
47074
+ positionTooltip(tooltip, styleOptionButton);
47075
+ }
47044
47076
  });
47045
47077
  }
47046
47078
  Object.entries(_this.styleButtons).forEach(function (_a) {
@@ -47062,9 +47094,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47062
47094
  StyleControl.InvertOrderPositions = [exports.ControlPosition.TopRight, exports.ControlPosition.BottomRight];
47063
47095
  StyleControl.Css = {
47064
47096
  button: "azure-maps-control-button",
47097
+ listButton: "azure-maps-control-list-button",
47098
+ expanded: 'expanded',
47065
47099
  currentStyle: "curr-style",
47066
47100
  inUse: "in-use",
47067
- styleOptions: "style-options"
47101
+ styleOptions: "style-options",
47102
+ dropdown: "azure-maps-control-dropdown"
47068
47103
  };
47069
47104
  StyleControl.StyleNamesMap = {
47070
47105
  road: "Road",
@@ -49200,6 +49235,62 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
49200
49235
  }
49201
49236
  return geodesic;
49202
49237
  }
49238
+ /**
49239
+ * Denormalizes path on antimeridian, this makes lines with coordinates on the opposite side of the antimeridian to always cross it. Note that the path crossing antimeridian will contain longitude outside of -180 to 180 range.
49240
+ * See getPathSplitByAntimeridian when this is not desired.
49241
+ * @param path Array of position objects or linestring to denormalize
49242
+ * @returns A denormalized array of position objects, path crossing antimeridian will contain longitude outside of -180 to 180 range.
49243
+ */
49244
+ function getPathDenormalizedAtAntimerian(path) {
49245
+ var coords = Array.isArray(path) ? path : path.coordinates;
49246
+ return coords.reduce(function (targetPath, coord) {
49247
+ var last = targetPath.length > 0 ? targetPath[targetPath.length - 1] : null;
49248
+ // denormalize longitude on antimeridian crossing
49249
+ if (last && Math.abs(coord[0] - last[0]) > 180.0) {
49250
+ var denormLon = last[0] < 0 ? coord[0] - 360.0 : coord[0] + 360.0;
49251
+ targetPath.push([denormLon, coord[1]]);
49252
+ }
49253
+ else {
49254
+ targetPath.push(coord);
49255
+ }
49256
+ return targetPath;
49257
+ }, []);
49258
+ }
49259
+ /**
49260
+ * Split path on antimeridian into multiple paths.
49261
+ * See getPathDenormalizedAtAntimerian when this is not desired.
49262
+ * @param path Array of position objects or linestring to split
49263
+ * @returns A path split into multiple paths by antimeridian.
49264
+ */
49265
+ function getPathSplitByAntimeridian(path) {
49266
+ var coords = Array.isArray(path) ? path : path.coordinates;
49267
+ var currentNonCrossing = [];
49268
+ var outputPaths = [];
49269
+ for (var k = 0; k < coords.length; k++) {
49270
+ currentNonCrossing.push(coords[k]);
49271
+ if (k + 1 >= coords.length) {
49272
+ continue;
49273
+ }
49274
+ var _a = __read(coords[k], 2), lon1 = _a[0], lat1 = _a[1];
49275
+ var _b = __read(coords[k + 1], 2), lon2 = _b[0], lat2 = _b[1];
49276
+ // split the line by antimeridian
49277
+ // and break geodesic into two line segments
49278
+ if (Math.abs(lon2 - lon1) > 180.0) {
49279
+ var denormLon2 = lon1 > 0 ? lon2 + 360.0 : lon2 - 360.0;
49280
+ var antiLon = lon1 > 0 ? 180.0 : -180.0;
49281
+ var abs = Math.abs(denormLon2 - lon1);
49282
+ var antiAbs = Math.abs(antiLon - lon1);
49283
+ var f = antiAbs / abs;
49284
+ var dLat = (lat2 - lat1) * f;
49285
+ var antiLat = lat1 + dLat;
49286
+ currentNonCrossing.push([antiLon, antiLat]);
49287
+ outputPaths.push(currentNonCrossing);
49288
+ currentNonCrossing = [[-antiLon, antiLat]];
49289
+ }
49290
+ }
49291
+ outputPaths.push(currentNonCrossing);
49292
+ return outputPaths;
49293
+ }
49203
49294
  /**
49204
49295
  * Takes an array of positions objects and fills in the space between them with accurately positioned positions to form an approximated Geodesic path.
49205
49296
  * @param path Array of position objects that form a path to fill in.
@@ -49223,18 +49314,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
49223
49314
  // Convert positions from degrees to Radians
49224
49315
  geodesic = geodesic.concat(_constructGeodesic(locs[i], locs[i + 1], nodeSize));
49225
49316
  }
49226
- return geodesic.reduce(function (targetPath, coord) {
49227
- var last = targetPath.length > 0 ? targetPath[targetPath.length - 1] : null;
49228
- // denormalize longitude on antimeridian crossing
49229
- if (last && Math.abs(coord[0] - last[0]) > 180.0) {
49230
- var denormLon = last[0] < 0 ? coord[0] - 360.0 : coord[0] + 360.0;
49231
- targetPath.push([denormLon, coord[1]]);
49232
- }
49233
- else {
49234
- targetPath.push(coord);
49235
- }
49236
- return targetPath;
49237
- }, []);
49317
+ return getPathDenormalizedAtAntimerian(geodesic);
49238
49318
  }
49239
49319
  /**
49240
49320
  * Takes an array of positions objects and fills in the space between them with accurately positioned positions to form an approximated Geodesic path broken by antimeridian into multiple sub-paths.
@@ -49361,15 +49441,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
49361
49441
  return null;
49362
49442
  }
49363
49443
  /**
49364
- * Calculates an array of position objects that are an equal distance away from a central point to create a regular polygon.
49365
- * @param origin Center of the regular polygon.
49366
- * @param radius Radius of the regular polygon.
49367
- * @param numberOfPositions Number of positions the polygon should have.
49368
- * @param units Unit of distance measurement. Default is meters.
49369
- * @param offset An offset to rotate the polygon. When 0 the first position will align with North.
49370
- * @returns An array of position objects that form a regular polygon.
49444
+ * constructs raw regular polygon path that doesn't handle antimeridian crossing
49371
49445
  */
49372
- function getRegularPolygonPath(origin, radius, numberOfPositions, units, offset) {
49446
+ function _constructRegularPolygonPath(origin, radius, numberOfPositions, units, offset) {
49373
49447
  units = units || "meters";
49374
49448
  offset = (offset) ? offset : 0;
49375
49449
  origin = getPosition(origin);
@@ -49378,9 +49452,32 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
49378
49452
  for (var i = 0; i <= numberOfPositions; i++) {
49379
49453
  points.push(getDestination(origin, (i * centralAngle + offset) % 360, radius, units));
49380
49454
  }
49381
- // TODO: Check for crossing the antimeridian, consider splitting path by -180/180 longitude
49382
49455
  return points;
49383
49456
  }
49457
+ /**
49458
+ * Calculates an array of position objects that are an equal distance away from a central point to create a regular polygon.
49459
+ * @param origin Center of the regular polygon.
49460
+ * @param radius Radius of the regular polygon.
49461
+ * @param numberOfPositions Number of positions the polygon should have.
49462
+ * @param units Unit of distance measurement. Default is meters.
49463
+ * @param offset An offset to rotate the polygon. When 0 the first position will align with North.
49464
+ * @returns An array of position objects that form a regular polygon. Path crossing antimeridian will contain longitude outside of -180 to 180 range. See getRegularPolygonPaths() when this is undesired.
49465
+ */
49466
+ function getRegularPolygonPath(origin, radius, numberOfPositions, units, offset) {
49467
+ return getPathDenormalizedAtAntimerian(_constructRegularPolygonPath(origin, radius, numberOfPositions, units, offset));
49468
+ }
49469
+ /**
49470
+ * Calculates an array of position objects that are an equal distance away from a central point to create a regular polygon broken by antimeridian into multiple sub-paths.
49471
+ * @param origin Center of the regular polygon.
49472
+ * @param radius Radius of the regular polygon.
49473
+ * @param numberOfPositions Number of positions the polygon should have.
49474
+ * @param units Unit of distance measurement. Default is meters.
49475
+ * @param offset An offset to rotate the polygon. When 0 the first position will align with North.
49476
+ * @returns An array of paths that form a regular polygon. Comparing to getRegularPolygonPath, sub-paths will always contain longitude in -180 to 180 range
49477
+ */
49478
+ function getRegularPolygonPaths(origin, radius, numberOfPositions, units, offset) {
49479
+ return getPathSplitByAntimeridian(_constructRegularPolygonPath(origin, radius, numberOfPositions, units, offset));
49480
+ }
49384
49481
  /**
49385
49482
  * Calculates a position object that is a fractional distance between two position objects.
49386
49483
  * @param origin First position to calculate mid-point between.
@@ -50701,12 +50798,15 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
50701
50798
  getDestination: getDestination,
50702
50799
  getDistanceTo: getDistanceTo,
50703
50800
  getEarthRadius: getEarthRadius,
50801
+ getPathDenormalizedAtAntimerian: getPathDenormalizedAtAntimerian,
50802
+ getPathSplitByAntimeridian: getPathSplitByAntimeridian,
50704
50803
  getGeodesicPath: getGeodesicPath,
50705
50804
  getGeodesicPaths: getGeodesicPaths,
50706
50805
  getHeading: getHeading,
50707
50806
  getLengthOfPath: getLengthOfPath,
50708
50807
  getPositionAlongPath: getPositionAlongPath,
50709
50808
  getRegularPolygonPath: getRegularPolygonPath,
50809
+ getRegularPolygonPaths: getRegularPolygonPaths,
50710
50810
  interpolate: interpolate,
50711
50811
  normalizeLatitude: normalizeLatitude,
50712
50812
  normalizeLongitude: normalizeLongitude,
@@ -57890,10 +57990,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
57890
57990
  if (!_this._rotateTimeout) {
57891
57991
  if (Date.now() - _this._lastHeadingTime >= _this._headUpdateLimit) {
57892
57992
  // If the min required time has already passed just do the update.
57993
+ // tslint:disable-next-line: no-string-based-set-timeout
57893
57994
  _this._rotateTimeout = setTimeout(_this._updateHeading, CompassControl.RotationDuration + 25);
57894
57995
  }
57895
57996
  else {
57896
57997
  // If the min required time hasn't passed start a timeout if doesn't already exist.
57998
+ // tslint:disable-next-line: no-string-based-set-timeout
57897
57999
  _this._rotateTimeout = setTimeout(_this._updateHeading, _this._headUpdateLimit - (Date.now() - _this._lastHeadingTime));
57898
58000
  }
57899
58001
  }
@@ -57915,6 +58017,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
57915
58017
  this._onMoveEnd = function (event) {
57916
58018
  if (event.fromControl) {
57917
58019
  // If the move end event originated from a control element delay the response to batch control clicks.
58020
+ // tslint:disable-next-line: no-string-based-set-timeout
57918
58021
  _this._controlTimeout = setTimeout(_this._updateCam, _this._controlEventDelay);
57919
58022
  }
57920
58023
  else {
@@ -57926,6 +58029,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
57926
58029
  this._onStyleData = function () {
57927
58030
  // Use setTimeout with no delay to allow mapbox time to
57928
58031
  // update the value of .loaded() before we check it.
58032
+ // tslint:disable-next-line: no-string-based-set-timeout
57929
58033
  setTimeout(_this._updateStyle);
57930
58034
  };
57931
58035
  /** Event handler for when the mouse or touch goes down */
@@ -58745,11 +58849,33 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
58745
58849
  "Rotate 15 degrees counter clockwise: shift + left arrow.",
58746
58850
  "Increase pitch 10 degrees: shift + up arrow.",
58747
58851
  "Decrease pitch 10 degrees: shift + down arrow.",
58748
- "Toggle verbose map state: control + alt + D.",
58852
+ // Interesting... i'm not sure that verbose map state was ever implemented
58853
+ // "Toggle verbose map state: control + alt + D.",
58749
58854
  "Jump focus to the map: Escape."
58750
58855
  ].join("\n");
58751
58856
  _this.map.getCanvasContainer().appendChild(_this.atlasMapKeyBindings);
58752
58857
  _this.atlasMapKeyBindings.setAttribute("aria-live", "polite");
58858
+ var baseShortcutKeyCodes = [
58859
+ // - (zoom out)
58860
+ 189,
58861
+ // = (zoom in)
58862
+ 187,
58863
+ // arrow up
58864
+ 38,
58865
+ // arrow left
58866
+ 37,
58867
+ // arrow right
58868
+ 39,
58869
+ // arrow down
58870
+ 40
58871
+ ];
58872
+ // accessibility recommendation: After using any of the map shortcut keys, NVDA should not read all the shortcut keys again.
58873
+ var mapCanvas = _this.map._getMap()._canvas;
58874
+ mapCanvas === null || mapCanvas === void 0 ? void 0 : mapCanvas.addEventListener('keyup', function (event) {
58875
+ if (baseShortcutKeyCodes.find(function (code) { return event.keyCode === code; })) {
58876
+ _this.atlasMapKeyBindings.innerHTML = '';
58877
+ }
58878
+ });
58753
58879
  };
58754
58880
  this.initializeMapLiveStateInfo = function () {
58755
58881
  _this.mapViewDesc = new MapViewDescriptor(_this.map, _this.updateMapState);
@@ -58759,7 +58885,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
58759
58885
  _this.atlasMapLiveStateInfo.id = "atlas-map-state";
58760
58886
  _this.atlasMapLiveStateInfo.classList.add("hidden-accessible-element");
58761
58887
  _this.map.getCanvasContainer().appendChild(_this.atlasMapLiveStateInfo);
58762
- _this.atlasMapLiveStateInfo.setAttribute("aria-live", "polite");
58888
+ //this.atlasMapLiveStateInfo.setAttribute("aria-live", "polite");
58763
58889
  };
58764
58890
  this.initializeMapStyleInfo = function () {
58765
58891
  _this.atlasMapStyleInfo = document.createElement("div");
@@ -59302,92 +59428,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
59302
59428
  return FocusShortcutHandler;
59303
59429
  }());
59304
59430
 
59305
- /** A handler that adds support for pitch gestures on mobile devices. */
59306
- var MobilePitchHandler = /** @class */ (function () {
59307
- function MobilePitchHandler(map) {
59308
- var _this = this;
59309
- // Constants for mobile pitch support.
59310
- this.minDiffX = 70; // min x distance to recognize pitch gesture
59311
- this.maxDiffY = 100; // max y distance to recognize pitch gesture
59312
- this.minDiff = 30; // min distance to recognize zoom gesture
59313
- this.delay = 160; // delay for pitch, in case it's a zoom gesture
59314
- /** Callback for the touch start event */
59315
- this._onTouchStart = function (data) {
59316
- if (data.points.length === 2) {
59317
- var diffY = data.points[0].y - data.points[1].y;
59318
- var diffX = data.points[0].x - data.points[1].x;
59319
- if (Math.abs(diffX) >= _this.minDiffX && Math.abs(diffY) <= _this.maxDiffY) {
59320
- data.originalEvent.preventDefault(); // prevent browser refresh on pull down
59321
- _this.map._getMap().touchZoomRotate.disable(); // disable native touch controls
59322
- _this.map._getMap().dragPan.disable();
59323
- _this.dpPoint = data.point;
59324
- _this.dpPitch = _this.map._getMap().getPitch();
59325
- _this.startTiming = Date.now();
59326
- _this.startDistance = Math.hypot(diffX, diffY);
59327
- _this.startEventData = data;
59328
- }
59329
- }
59330
- };
59331
- /** Callback for the touch move event */
59332
- this._onTouchMove = function (data) {
59333
- if (_this.dpPoint !== undefined && _this.dpPitch !== undefined) {
59334
- data.preventDefault();
59335
- data.originalEvent.preventDefault();
59336
- var diffY = data.points[0].y - data.points[1].y;
59337
- var diffX = data.points[0].x - data.points[1].x;
59338
- var distance = Math.hypot(diffX, diffY);
59339
- if (Math.abs(distance - _this.startDistance) >= _this.minDiff) {
59340
- if (_this.dpPoint) {
59341
- _this.map._getMap().touchZoomRotate.enable();
59342
- _this.map._getMap().dragPan.enable();
59343
- _this.map._getMap().touchZoomRotate.onStart(Date.now() - _this.startTiming >= _this.delay
59344
- ? data.originalEvent
59345
- : _this.startEventData.originalEvent);
59346
- }
59347
- _this.dpPoint = undefined;
59348
- return;
59349
- }
59350
- if (Date.now() - _this.startTiming >= _this.delay) {
59351
- var diff = (_this.dpPoint.y - data.point.y) * 0.5;
59352
- _this.map._getMap().setPitch(_this.dpPitch + diff);
59353
- }
59354
- }
59355
- };
59356
- /** Callback for the touch end event */
59357
- this._onTouchEnd = function () {
59358
- if (_this.dpPoint) {
59359
- _this.map._getMap().touchZoomRotate.enable();
59360
- _this.map._getMap().dragPan.enable();
59361
- }
59362
- _this.dpPoint = undefined;
59363
- };
59364
- /** Callback for the touch cancel event */
59365
- this._onTouchCancel = function () {
59366
- if (_this.dpPoint) {
59367
- _this.map._getMap().touchZoomRotate.enable();
59368
- _this.map._getMap().dragPan.enable();
59369
- }
59370
- _this.dpPoint = undefined;
59371
- };
59372
- this.map = map;
59373
- }
59374
- /** Enables the mobile pitch gesture support. */
59375
- MobilePitchHandler.prototype.enable = function () {
59376
- this.map._getMap().on("touchstart", this._onTouchStart);
59377
- this.map._getMap().on("touchmove", this._onTouchMove);
59378
- this.map._getMap().on("touchend", this._onTouchEnd);
59379
- this.map._getMap().on("touchcancel", this._onTouchCancel);
59380
- };
59381
- /** Disables the mobile pitch gesture support. */
59382
- MobilePitchHandler.prototype.disable = function () {
59383
- this.map._getMap().off("touchstart", this._onTouchStart);
59384
- this.map._getMap().off("touchmove", this._onTouchMove);
59385
- this.map._getMap().off("touchend", this._onTouchEnd);
59386
- this.map._getMap().off("touchcancel", this._onTouchCancel);
59387
- };
59388
- return MobilePitchHandler;
59389
- }());
59390
-
59391
59431
  /** A handler that adds support for pinch and zoom gestures on devices without touch events. */
59392
59432
  var PinchZoomHandler = /** @class */ (function () {
59393
59433
  function PinchZoomHandler(map) {
@@ -59438,7 +59478,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
59438
59478
  function UserInteractionDelegate(map, options) {
59439
59479
  this.added = false;
59440
59480
  this.map = map;
59441
- this.mobilePitch = new MobilePitchHandler(map);
59442
59481
  this.focusShortcut = new FocusShortcutHandler(map);
59443
59482
  this.pinchZoom = new PinchZoomHandler(map);
59444
59483
  this.options = new UserInteractionOptions().merge(options);
@@ -59484,7 +59523,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
59484
59523
  this.focusShortcut.disable();
59485
59524
  this.map._getMap().scrollZoom.disable();
59486
59525
  this.map._getMap().touchZoomRotate.disable();
59487
- this.mobilePitch.disable();
59488
59526
  this.pinchZoom.disable();
59489
59527
  }
59490
59528
  else {
@@ -59536,12 +59574,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
59536
59574
  // Touch
59537
59575
  if (options.touchInteraction) {
59538
59576
  this.map._getMap().touchZoomRotate.enable();
59539
- this.mobilePitch.enable();
59540
59577
  this.pinchZoom.enable();
59541
59578
  }
59542
59579
  else {
59543
59580
  this.map._getMap().touchZoomRotate.disable();
59544
- this.mobilePitch.disable();
59545
59581
  this.pinchZoom.enable();
59546
59582
  }
59547
59583
  }
@@ -62300,6 +62336,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
62300
62336
  if (!cancel) {
62301
62337
  originalMethod.apply(context, args);
62302
62338
  shouldCancel.set(context, true);
62339
+ // tslint:disable-next-line: no-string-based-set-timeout
62303
62340
  setTimeout(function () { return shouldCancel.delete(context); }, duration);
62304
62341
  }
62305
62342
  };
@@ -64879,6 +64916,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
64879
64916
  _this._storeAccessToken(token);
64880
64917
  clearTimeout(_this.tokenTimeOutHandle); // Clear the previous refresh timeout in case it hadn't triggered yet.
64881
64918
  // @ts-ignore
64919
+ // tslint:disable-next-line: no-string-based-set-timeout
64882
64920
  _this.tokenTimeOutHandle = setTimeout(_this._triggerTokenFetch, timeout * 1000);
64883
64921
  resolve();
64884
64922
  }
@@ -64926,6 +64964,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
64926
64964
  }
64927
64965
  // Login and acquire a token.
64928
64966
  // Fire it async so that users can add any listeners for token acquire events first.
64967
+ // tslint:disable-next-line: no-string-based-set-timeout
64929
64968
  setTimeout(function () { return _this._loginAndAcquire(resolve, reject); });
64930
64969
  }
64931
64970
  else if (_this.options.authType === exports.AuthenticationType.anonymous) {
@@ -65014,6 +65053,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
65014
65053
  _this.options.aadAppId));
65015
65054
  }
65016
65055
  }
65056
+ // tslint:disable-next-line: no-string-based-set-interval
65017
65057
  }, 25);
65018
65058
  }
65019
65059
  };
@@ -65769,6 +65809,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
65769
65809
  // This is for consistency with the case where the load event hasn't already fired.
65770
65810
  // If the load event hasn't already fired the callback will also be executed async once it does fire.
65771
65811
  var loadData_1 = { type: "load", map: this.map };
65812
+ // tslint:disable-next-line: no-string-based-set-timeout
65772
65813
  setTimeout(function () { return modifiedCallback(loadData_1); });
65773
65814
  }
65774
65815
  else if (eventType === "ready") {
@@ -65777,6 +65818,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
65777
65818
  if (this.map._isReady()) {
65778
65819
  // Manually execute the callback if the ready event has already fired.
65779
65820
  var readyData_1 = { type: "ready", map: this.map };
65821
+ // tslint:disable-next-line: no-string-based-set-timeout
65780
65822
  setTimeout(function () { return modifiedCallback(readyData_1); });
65781
65823
  }
65782
65824
  }
@@ -66162,6 +66204,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
66162
66204
  timeoutId_1 = setTimeout(function () {
66163
66205
  timedOut_1 = true;
66164
66206
  reject("Failed to load image within specified timeout: " + _this.imageLoadTimeout + " ms.");
66207
+ // tslint:disable-next-line: no-string-based-set-timeout
66165
66208
  }, _this.imageLoadTimeout);
66166
66209
  }
66167
66210
  });
@@ -68017,6 +68060,31 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68017
68060
  * By default, it is set to half the number of CPU cores (capped at 6).
68018
68061
  */
68019
68062
  _this.workerCount = getWorkerCount();
68063
+ /**
68064
+ * Controls the duration of the fade-in/fade-out animation for label collisions, in milliseconds.
68065
+ * This setting affects all symbol layers.
68066
+ * This setting does not affect the duration of runtime styling transitions or raster tile cross-fading.
68067
+ * @default 300
68068
+ */
68069
+ _this.fadeDuration = 300;
68070
+ /**
68071
+ * Defines a CSS font-family for locally overriding generation of glyphs in the
68072
+ * 'CJK Unified Ideographs', 'Hiragana', 'Katakana' and 'Hangul Syllables' ranges.
68073
+ * In these ranges, font settings from the map's style will be ignored,
68074
+ * except for font-weight keywords (light/regular/medium/bold). Set to false,
68075
+ * to enable font settings from the map's style for these glyph ranges.
68076
+ * The purpose of this option is to avoid bandwidth-intensive glyph server requests.
68077
+ * @default 'sans-serif'
68078
+ */
68079
+ _this.localIdeographFontFamily = 'sans-serif';
68080
+ /**
68081
+ * True to validate styles before it's getting applied.
68082
+ * Validation takes significant(few hundred ms) time to process styles during initial load.
68083
+ * Can be set to false for production environment to improve performance.
68084
+ * @internal
68085
+ * @default 'true'
68086
+ */
68087
+ _this.validateStyle = true;
68020
68088
  return _this;
68021
68089
  }
68022
68090
  /**
@@ -68175,7 +68243,15 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68175
68243
  * @internal
68176
68244
  */
68177
68245
  function StyleManager(map, serviceOptions) {
68246
+ var _this = this;
68178
68247
  this.apiVersion = "2.0";
68248
+ this._onStyleData = function () {
68249
+ _this.map.events.invoke("stylechanged", {
68250
+ style: _this._lookUp(_this.map.getStyle()).name,
68251
+ map: _this.map,
68252
+ type: "stylechanged"
68253
+ });
68254
+ };
68179
68255
  this.map = map;
68180
68256
  this.serviceOptions = serviceOptions;
68181
68257
  }
@@ -68216,7 +68292,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68216
68292
  StyleManager.prototype.setStyleUrl = function (styleOptions) {
68217
68293
  var styleUrl = this.getStyleUrl(styleOptions);
68218
68294
  try {
68219
- this.map._getMap().setStyle(styleUrl, { diff: true, stylePatch: this._stylePatch.bind(this) });
68295
+ this.map._getMap().setStyle(styleUrl, {
68296
+ diff: true,
68297
+ stylePatch: this._stylePatch.bind(this),
68298
+ validate: this.serviceOptions.validateStyle
68299
+ });
68220
68300
  }
68221
68301
  catch (e) {
68222
68302
  throw e;
@@ -68280,6 +68360,22 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68280
68360
  */
68281
68361
  StyleManager.prototype._stylePatch = function (previousStyle, nextStyle, preserveLayer, updatePaintProperty, updateLayoutProperty, updateFilter) {
68282
68362
  var _this = this;
68363
+ // Layers in the next style with default properties that do not align with current StyleOptions
68364
+ // should be modified before they are applied to the map.
68365
+ var styleOptions = this.map.getStyle();
68366
+ var trafficOptions = this.map.getTraffic();
68367
+ // force a replacement of language placeholder in the tileset url to avoid resolution to a same cache with placeholders on language change
68368
+ nextStyle.sources = Object.entries(nextStyle.sources).reduce(function (newSources, _a) {
68369
+ var _b = __read(_a, 2), sourceKey = _b[0], source = _b[1];
68370
+ var newSource = __assign({}, source);
68371
+ if ('url' in newSource && typeof newSource.url === 'string') {
68372
+ if (newSource.url.includes(constants.languagePlaceHolder)) {
68373
+ newSource.url = newSource.url.replace(constants.languagePlaceHolder, styleOptions.language);
68374
+ }
68375
+ }
68376
+ newSources[sourceKey] = newSource;
68377
+ return newSources;
68378
+ }, {});
68283
68379
  // A FundamentalMapLayer (grouped layer) representation of the next style must be built.
68284
68380
  var previousLayers = this.map.layers.getLayers();
68285
68381
  var nextLayers = [];
@@ -68290,10 +68386,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68290
68386
  currentLayerGroupId = nextLayerGroup;
68291
68387
  currentLayerGroupLayers = [];
68292
68388
  };
68293
- // Layers in the next style with default properties that do not align with current StyleOptions
68294
- // should be modified before they are applied to the map.
68295
- var styleOptions = this.map.getStyle();
68296
- var trafficOptions = this.map.getTraffic();
68297
68389
  nextStyle.layers.forEach(function (nextLayer) {
68298
68390
  var _a, _b, _c;
68299
68391
  var layerGroup = LayerGroupComparator.getLayerGroup(nextLayer.id);
@@ -68376,13 +68468,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68376
68468
  preserveLayer(userLayer.layer.getId(), before === null || before === void 0 ? void 0 : before.id);
68377
68469
  });
68378
68470
  this.map.sources._syncSources(nextStyle.sources);
68379
- this.map.events.addOnce("styledata", function (eventData) {
68380
- _this.map.events.invoke("stylechanged", {
68381
- style: _this._lookUp(_this.map.getStyle()).name,
68382
- map: _this.map,
68383
- type: "stylechanged"
68384
- });
68385
- });
68471
+ // If there was a previous styledata change event attached, remove it.
68472
+ // When the sprite url changes between style changes then mapbox can't perform the diff
68473
+ // In such cases it recalculate the style again. Removing previous attached
68474
+ // event listner makes sure that style changed event is not fired twice in these cases.
68475
+ this.map.events.remove("styledata", this._onStyleData);
68476
+ this.map.events.addOnce("styledata", this._onStyleData);
68386
68477
  };
68387
68478
  StyleManager.prototype._buildFundamentalLayerFrom = function (layers, id) {
68388
68479
  if (layers && layers.length > 0) {
@@ -68556,6 +68647,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68556
68647
  var mapboxMapOptions = {
68557
68648
  attributionControl: false,
68558
68649
  container: container,
68650
+ fadeDuration: _this.serviceOptions.fadeDuration,
68651
+ localIdeographFontFamily: _this.serviceOptions.localIdeographFontFamily,
68559
68652
  preserveDrawingBuffer: _this.styleOptions.preserveDrawingBuffer,
68560
68653
  refreshExpiredTiles: _this.serviceOptions.refreshExpiredTiles,
68561
68654
  renderWorldCopies: _this.styleOptions.renderWorldCopies,