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.
package/dist/atlas.js CHANGED
@@ -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,
@@ -68071,10 +68171,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68071
68171
  if (!_this._rotateTimeout) {
68072
68172
  if (Date.now() - _this._lastHeadingTime >= _this._headUpdateLimit) {
68073
68173
  // If the min required time has already passed just do the update.
68174
+ // tslint:disable-next-line: no-string-based-set-timeout
68074
68175
  _this._rotateTimeout = setTimeout(_this._updateHeading, CompassControl.RotationDuration + 25);
68075
68176
  }
68076
68177
  else {
68077
68178
  // If the min required time hasn't passed start a timeout if doesn't already exist.
68179
+ // tslint:disable-next-line: no-string-based-set-timeout
68078
68180
  _this._rotateTimeout = setTimeout(_this._updateHeading, _this._headUpdateLimit - (Date.now() - _this._lastHeadingTime));
68079
68181
  }
68080
68182
  }
@@ -68096,6 +68198,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68096
68198
  this._onMoveEnd = function (event) {
68097
68199
  if (event.fromControl) {
68098
68200
  // If the move end event originated from a control element delay the response to batch control clicks.
68201
+ // tslint:disable-next-line: no-string-based-set-timeout
68099
68202
  _this._controlTimeout = setTimeout(_this._updateCam, _this._controlEventDelay);
68100
68203
  }
68101
68204
  else {
@@ -68107,6 +68210,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68107
68210
  this._onStyleData = function () {
68108
68211
  // Use setTimeout with no delay to allow mapbox time to
68109
68212
  // update the value of .loaded() before we check it.
68213
+ // tslint:disable-next-line: no-string-based-set-timeout
68110
68214
  setTimeout(_this._updateStyle);
68111
68215
  };
68112
68216
  /** Event handler for when the mouse or touch goes down */
@@ -68926,11 +69030,33 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68926
69030
  "Rotate 15 degrees counter clockwise: shift + left arrow.",
68927
69031
  "Increase pitch 10 degrees: shift + up arrow.",
68928
69032
  "Decrease pitch 10 degrees: shift + down arrow.",
68929
- "Toggle verbose map state: control + alt + D.",
69033
+ // Interesting... i'm not sure that verbose map state was ever implemented
69034
+ // "Toggle verbose map state: control + alt + D.",
68930
69035
  "Jump focus to the map: Escape."
68931
69036
  ].join("\n");
68932
69037
  _this.map.getCanvasContainer().appendChild(_this.atlasMapKeyBindings);
68933
69038
  _this.atlasMapKeyBindings.setAttribute("aria-live", "polite");
69039
+ var baseShortcutKeyCodes = [
69040
+ // - (zoom out)
69041
+ 189,
69042
+ // = (zoom in)
69043
+ 187,
69044
+ // arrow up
69045
+ 38,
69046
+ // arrow left
69047
+ 37,
69048
+ // arrow right
69049
+ 39,
69050
+ // arrow down
69051
+ 40
69052
+ ];
69053
+ // accessibility recommendation: After using any of the map shortcut keys, NVDA should not read all the shortcut keys again.
69054
+ var mapCanvas = _this.map._getMap()._canvas;
69055
+ mapCanvas === null || mapCanvas === void 0 ? void 0 : mapCanvas.addEventListener('keyup', function (event) {
69056
+ if (baseShortcutKeyCodes.find(function (code) { return event.keyCode === code; })) {
69057
+ _this.atlasMapKeyBindings.innerHTML = '';
69058
+ }
69059
+ });
68934
69060
  };
68935
69061
  this.initializeMapLiveStateInfo = function () {
68936
69062
  _this.mapViewDesc = new MapViewDescriptor(_this.map, _this.updateMapState);
@@ -68940,7 +69066,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68940
69066
  _this.atlasMapLiveStateInfo.id = "atlas-map-state";
68941
69067
  _this.atlasMapLiveStateInfo.classList.add("hidden-accessible-element");
68942
69068
  _this.map.getCanvasContainer().appendChild(_this.atlasMapLiveStateInfo);
68943
- _this.atlasMapLiveStateInfo.setAttribute("aria-live", "polite");
69069
+ //this.atlasMapLiveStateInfo.setAttribute("aria-live", "polite");
68944
69070
  };
68945
69071
  this.initializeMapStyleInfo = function () {
68946
69072
  _this.atlasMapStyleInfo = document.createElement("div");
@@ -69483,92 +69609,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
69483
69609
  return FocusShortcutHandler;
69484
69610
  }());
69485
69611
 
69486
- /** A handler that adds support for pitch gestures on mobile devices. */
69487
- var MobilePitchHandler = /** @class */ (function () {
69488
- function MobilePitchHandler(map) {
69489
- var _this = this;
69490
- // Constants for mobile pitch support.
69491
- this.minDiffX = 70; // min x distance to recognize pitch gesture
69492
- this.maxDiffY = 100; // max y distance to recognize pitch gesture
69493
- this.minDiff = 30; // min distance to recognize zoom gesture
69494
- this.delay = 160; // delay for pitch, in case it's a zoom gesture
69495
- /** Callback for the touch start event */
69496
- this._onTouchStart = function (data) {
69497
- if (data.points.length === 2) {
69498
- var diffY = data.points[0].y - data.points[1].y;
69499
- var diffX = data.points[0].x - data.points[1].x;
69500
- if (Math.abs(diffX) >= _this.minDiffX && Math.abs(diffY) <= _this.maxDiffY) {
69501
- data.originalEvent.preventDefault(); // prevent browser refresh on pull down
69502
- _this.map._getMap().touchZoomRotate.disable(); // disable native touch controls
69503
- _this.map._getMap().dragPan.disable();
69504
- _this.dpPoint = data.point;
69505
- _this.dpPitch = _this.map._getMap().getPitch();
69506
- _this.startTiming = Date.now();
69507
- _this.startDistance = Math.hypot(diffX, diffY);
69508
- _this.startEventData = data;
69509
- }
69510
- }
69511
- };
69512
- /** Callback for the touch move event */
69513
- this._onTouchMove = function (data) {
69514
- if (_this.dpPoint !== undefined && _this.dpPitch !== undefined) {
69515
- data.preventDefault();
69516
- data.originalEvent.preventDefault();
69517
- var diffY = data.points[0].y - data.points[1].y;
69518
- var diffX = data.points[0].x - data.points[1].x;
69519
- var distance = Math.hypot(diffX, diffY);
69520
- if (Math.abs(distance - _this.startDistance) >= _this.minDiff) {
69521
- if (_this.dpPoint) {
69522
- _this.map._getMap().touchZoomRotate.enable();
69523
- _this.map._getMap().dragPan.enable();
69524
- _this.map._getMap().touchZoomRotate.onStart(Date.now() - _this.startTiming >= _this.delay
69525
- ? data.originalEvent
69526
- : _this.startEventData.originalEvent);
69527
- }
69528
- _this.dpPoint = undefined;
69529
- return;
69530
- }
69531
- if (Date.now() - _this.startTiming >= _this.delay) {
69532
- var diff = (_this.dpPoint.y - data.point.y) * 0.5;
69533
- _this.map._getMap().setPitch(_this.dpPitch + diff);
69534
- }
69535
- }
69536
- };
69537
- /** Callback for the touch end event */
69538
- this._onTouchEnd = function () {
69539
- if (_this.dpPoint) {
69540
- _this.map._getMap().touchZoomRotate.enable();
69541
- _this.map._getMap().dragPan.enable();
69542
- }
69543
- _this.dpPoint = undefined;
69544
- };
69545
- /** Callback for the touch cancel event */
69546
- this._onTouchCancel = function () {
69547
- if (_this.dpPoint) {
69548
- _this.map._getMap().touchZoomRotate.enable();
69549
- _this.map._getMap().dragPan.enable();
69550
- }
69551
- _this.dpPoint = undefined;
69552
- };
69553
- this.map = map;
69554
- }
69555
- /** Enables the mobile pitch gesture support. */
69556
- MobilePitchHandler.prototype.enable = function () {
69557
- this.map._getMap().on("touchstart", this._onTouchStart);
69558
- this.map._getMap().on("touchmove", this._onTouchMove);
69559
- this.map._getMap().on("touchend", this._onTouchEnd);
69560
- this.map._getMap().on("touchcancel", this._onTouchCancel);
69561
- };
69562
- /** Disables the mobile pitch gesture support. */
69563
- MobilePitchHandler.prototype.disable = function () {
69564
- this.map._getMap().off("touchstart", this._onTouchStart);
69565
- this.map._getMap().off("touchmove", this._onTouchMove);
69566
- this.map._getMap().off("touchend", this._onTouchEnd);
69567
- this.map._getMap().off("touchcancel", this._onTouchCancel);
69568
- };
69569
- return MobilePitchHandler;
69570
- }());
69571
-
69572
69612
  /** A handler that adds support for pinch and zoom gestures on devices without touch events. */
69573
69613
  var PinchZoomHandler = /** @class */ (function () {
69574
69614
  function PinchZoomHandler(map) {
@@ -69619,7 +69659,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
69619
69659
  function UserInteractionDelegate(map, options) {
69620
69660
  this.added = false;
69621
69661
  this.map = map;
69622
- this.mobilePitch = new MobilePitchHandler(map);
69623
69662
  this.focusShortcut = new FocusShortcutHandler(map);
69624
69663
  this.pinchZoom = new PinchZoomHandler(map);
69625
69664
  this.options = new UserInteractionOptions().merge(options);
@@ -69665,7 +69704,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
69665
69704
  this.focusShortcut.disable();
69666
69705
  this.map._getMap().scrollZoom.disable();
69667
69706
  this.map._getMap().touchZoomRotate.disable();
69668
- this.mobilePitch.disable();
69669
69707
  this.pinchZoom.disable();
69670
69708
  }
69671
69709
  else {
@@ -69717,12 +69755,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
69717
69755
  // Touch
69718
69756
  if (options.touchInteraction) {
69719
69757
  this.map._getMap().touchZoomRotate.enable();
69720
- this.mobilePitch.enable();
69721
69758
  this.pinchZoom.enable();
69722
69759
  }
69723
69760
  else {
69724
69761
  this.map._getMap().touchZoomRotate.disable();
69725
- this.mobilePitch.disable();
69726
69762
  this.pinchZoom.enable();
69727
69763
  }
69728
69764
  }
@@ -72481,6 +72517,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
72481
72517
  if (!cancel) {
72482
72518
  originalMethod.apply(context, args);
72483
72519
  shouldCancel.set(context, true);
72520
+ // tslint:disable-next-line: no-string-based-set-timeout
72484
72521
  setTimeout(function () { return shouldCancel.delete(context); }, duration);
72485
72522
  }
72486
72523
  };
@@ -75060,6 +75097,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
75060
75097
  _this._storeAccessToken(token);
75061
75098
  clearTimeout(_this.tokenTimeOutHandle); // Clear the previous refresh timeout in case it hadn't triggered yet.
75062
75099
  // @ts-ignore
75100
+ // tslint:disable-next-line: no-string-based-set-timeout
75063
75101
  _this.tokenTimeOutHandle = setTimeout(_this._triggerTokenFetch, timeout * 1000);
75064
75102
  resolve();
75065
75103
  }
@@ -75107,6 +75145,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
75107
75145
  }
75108
75146
  // Login and acquire a token.
75109
75147
  // Fire it async so that users can add any listeners for token acquire events first.
75148
+ // tslint:disable-next-line: no-string-based-set-timeout
75110
75149
  setTimeout(function () { return _this._loginAndAcquire(resolve, reject); });
75111
75150
  }
75112
75151
  else if (_this.options.authType === exports.AuthenticationType.anonymous) {
@@ -75195,6 +75234,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
75195
75234
  _this.options.aadAppId));
75196
75235
  }
75197
75236
  }
75237
+ // tslint:disable-next-line: no-string-based-set-interval
75198
75238
  }, 25);
75199
75239
  }
75200
75240
  };
@@ -75950,6 +75990,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
75950
75990
  // This is for consistency with the case where the load event hasn't already fired.
75951
75991
  // If the load event hasn't already fired the callback will also be executed async once it does fire.
75952
75992
  var loadData_1 = { type: "load", map: this.map };
75993
+ // tslint:disable-next-line: no-string-based-set-timeout
75953
75994
  setTimeout(function () { return modifiedCallback(loadData_1); });
75954
75995
  }
75955
75996
  else if (eventType === "ready") {
@@ -75958,6 +75999,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
75958
75999
  if (this.map._isReady()) {
75959
76000
  // Manually execute the callback if the ready event has already fired.
75960
76001
  var readyData_1 = { type: "ready", map: this.map };
76002
+ // tslint:disable-next-line: no-string-based-set-timeout
75961
76003
  setTimeout(function () { return modifiedCallback(readyData_1); });
75962
76004
  }
75963
76005
  }
@@ -76343,6 +76385,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
76343
76385
  timeoutId_1 = setTimeout(function () {
76344
76386
  timedOut_1 = true;
76345
76387
  reject("Failed to load image within specified timeout: " + _this.imageLoadTimeout + " ms.");
76388
+ // tslint:disable-next-line: no-string-based-set-timeout
76346
76389
  }, _this.imageLoadTimeout);
76347
76390
  }
76348
76391
  });
@@ -78198,6 +78241,31 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
78198
78241
  * By default, it is set to half the number of CPU cores (capped at 6).
78199
78242
  */
78200
78243
  _this.workerCount = getWorkerCount();
78244
+ /**
78245
+ * Controls the duration of the fade-in/fade-out animation for label collisions, in milliseconds.
78246
+ * This setting affects all symbol layers.
78247
+ * This setting does not affect the duration of runtime styling transitions or raster tile cross-fading.
78248
+ * @default 300
78249
+ */
78250
+ _this.fadeDuration = 300;
78251
+ /**
78252
+ * Defines a CSS font-family for locally overriding generation of glyphs in the
78253
+ * 'CJK Unified Ideographs', 'Hiragana', 'Katakana' and 'Hangul Syllables' ranges.
78254
+ * In these ranges, font settings from the map's style will be ignored,
78255
+ * except for font-weight keywords (light/regular/medium/bold). Set to false,
78256
+ * to enable font settings from the map's style for these glyph ranges.
78257
+ * The purpose of this option is to avoid bandwidth-intensive glyph server requests.
78258
+ * @default 'sans-serif'
78259
+ */
78260
+ _this.localIdeographFontFamily = 'sans-serif';
78261
+ /**
78262
+ * True to validate styles before it's getting applied.
78263
+ * Validation takes significant(few hundred ms) time to process styles during initial load.
78264
+ * Can be set to false for production environment to improve performance.
78265
+ * @internal
78266
+ * @default 'true'
78267
+ */
78268
+ _this.validateStyle = true;
78201
78269
  return _this;
78202
78270
  }
78203
78271
  /**
@@ -78356,7 +78424,15 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
78356
78424
  * @internal
78357
78425
  */
78358
78426
  function StyleManager(map, serviceOptions) {
78427
+ var _this = this;
78359
78428
  this.apiVersion = "2.0";
78429
+ this._onStyleData = function () {
78430
+ _this.map.events.invoke("stylechanged", {
78431
+ style: _this._lookUp(_this.map.getStyle()).name,
78432
+ map: _this.map,
78433
+ type: "stylechanged"
78434
+ });
78435
+ };
78360
78436
  this.map = map;
78361
78437
  this.serviceOptions = serviceOptions;
78362
78438
  }
@@ -78397,7 +78473,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
78397
78473
  StyleManager.prototype.setStyleUrl = function (styleOptions) {
78398
78474
  var styleUrl = this.getStyleUrl(styleOptions);
78399
78475
  try {
78400
- this.map._getMap().setStyle(styleUrl, { diff: true, stylePatch: this._stylePatch.bind(this) });
78476
+ this.map._getMap().setStyle(styleUrl, {
78477
+ diff: true,
78478
+ stylePatch: this._stylePatch.bind(this),
78479
+ validate: this.serviceOptions.validateStyle
78480
+ });
78401
78481
  }
78402
78482
  catch (e) {
78403
78483
  throw e;
@@ -78461,6 +78541,22 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
78461
78541
  */
78462
78542
  StyleManager.prototype._stylePatch = function (previousStyle, nextStyle, preserveLayer, updatePaintProperty, updateLayoutProperty, updateFilter) {
78463
78543
  var _this = this;
78544
+ // Layers in the next style with default properties that do not align with current StyleOptions
78545
+ // should be modified before they are applied to the map.
78546
+ var styleOptions = this.map.getStyle();
78547
+ var trafficOptions = this.map.getTraffic();
78548
+ // force a replacement of language placeholder in the tileset url to avoid resolution to a same cache with placeholders on language change
78549
+ nextStyle.sources = Object.entries(nextStyle.sources).reduce(function (newSources, _a) {
78550
+ var _b = __read(_a, 2), sourceKey = _b[0], source = _b[1];
78551
+ var newSource = __assign({}, source);
78552
+ if ('url' in newSource && typeof newSource.url === 'string') {
78553
+ if (newSource.url.includes(constants.languagePlaceHolder)) {
78554
+ newSource.url = newSource.url.replace(constants.languagePlaceHolder, styleOptions.language);
78555
+ }
78556
+ }
78557
+ newSources[sourceKey] = newSource;
78558
+ return newSources;
78559
+ }, {});
78464
78560
  // A FundamentalMapLayer (grouped layer) representation of the next style must be built.
78465
78561
  var previousLayers = this.map.layers.getLayers();
78466
78562
  var nextLayers = [];
@@ -78471,10 +78567,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
78471
78567
  currentLayerGroupId = nextLayerGroup;
78472
78568
  currentLayerGroupLayers = [];
78473
78569
  };
78474
- // Layers in the next style with default properties that do not align with current StyleOptions
78475
- // should be modified before they are applied to the map.
78476
- var styleOptions = this.map.getStyle();
78477
- var trafficOptions = this.map.getTraffic();
78478
78570
  nextStyle.layers.forEach(function (nextLayer) {
78479
78571
  var _a, _b, _c;
78480
78572
  var layerGroup = LayerGroupComparator.getLayerGroup(nextLayer.id);
@@ -78557,13 +78649,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
78557
78649
  preserveLayer(userLayer.layer.getId(), before === null || before === void 0 ? void 0 : before.id);
78558
78650
  });
78559
78651
  this.map.sources._syncSources(nextStyle.sources);
78560
- this.map.events.addOnce("styledata", function (eventData) {
78561
- _this.map.events.invoke("stylechanged", {
78562
- style: _this._lookUp(_this.map.getStyle()).name,
78563
- map: _this.map,
78564
- type: "stylechanged"
78565
- });
78566
- });
78652
+ // If there was a previous styledata change event attached, remove it.
78653
+ // When the sprite url changes between style changes then mapbox can't perform the diff
78654
+ // In such cases it recalculate the style again. Removing previous attached
78655
+ // event listner makes sure that style changed event is not fired twice in these cases.
78656
+ this.map.events.remove("styledata", this._onStyleData);
78657
+ this.map.events.addOnce("styledata", this._onStyleData);
78567
78658
  };
78568
78659
  StyleManager.prototype._buildFundamentalLayerFrom = function (layers, id) {
78569
78660
  if (layers && layers.length > 0) {
@@ -78740,6 +78831,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
78740
78831
  var mapboxMapOptions = {
78741
78832
  attributionControl: false,
78742
78833
  container: container,
78834
+ fadeDuration: _this.serviceOptions.fadeDuration,
78835
+ localIdeographFontFamily: _this.serviceOptions.localIdeographFontFamily,
78743
78836
  preserveDrawingBuffer: _this.styleOptions.preserveDrawingBuffer,
78744
78837
  refreshExpiredTiles: _this.serviceOptions.refreshExpiredTiles,
78745
78838
  renderWorldCopies: _this.styleOptions.renderWorldCopies,