azure-maps-control 2.2.2 → 3.0.0-preview.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ReadMe.md +81 -40
- package/dist/atlas-core-bare-snr-min.js +55 -0
- package/dist/atlas-core-bare-snr.js +196 -173
- package/dist/atlas-core-bare.js +196 -173
- package/dist/atlas-core-bare.min.js +1 -1
- package/dist/atlas-core-snr.js +35846 -32675
- package/dist/atlas-core.js +35844 -32673
- package/dist/atlas-core.min.js +53 -1
- package/dist/atlas.css +373 -369
- package/dist/atlas.js +35833 -32662
- package/dist/atlas.min.css +1 -1
- package/dist/atlas.min.js +53 -1
- package/package.json +6 -6
- package/thirdpartynotices.txt +0 -0
|
@@ -56,9 +56,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
56
56
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('azuremaps-maplibre-gl')) :
|
|
57
57
|
typeof define === 'function' && define.amd ? define(['exports', 'azuremaps-maplibre-gl'], factory) :
|
|
58
58
|
(global = global || self, factory(global.atlas = global.atlas || {}, global.maplibregl));
|
|
59
|
-
}(this, (function (exports,
|
|
59
|
+
}(this, (function (exports, maplibregl) { 'use strict';
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
maplibregl = maplibregl && Object.prototype.hasOwnProperty.call(maplibregl, 'default') ? maplibregl['default'] : maplibregl;
|
|
62
62
|
|
|
63
63
|
var env = {
|
|
64
64
|
domain: "atlas.microsoft.com",
|
|
@@ -265,7 +265,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
265
265
|
return Url;
|
|
266
266
|
}());
|
|
267
267
|
|
|
268
|
-
var version = "
|
|
268
|
+
var version = "3.0.0-preview.2";
|
|
269
269
|
|
|
270
270
|
/**
|
|
271
271
|
* A helper class that provides methods for getting various forms of the map controls current version.
|
|
@@ -2881,11 +2881,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
2881
2881
|
* _.keysIn(new Foo);
|
|
2882
2882
|
* // => ['a', 'b', 'c'] (iteration order is not guaranteed)
|
|
2883
2883
|
*/
|
|
2884
|
-
function keysIn
|
|
2884
|
+
function keysIn(object) {
|
|
2885
2885
|
return isArrayLike_1(object) ? _arrayLikeKeys(object, true) : _baseKeysIn(object);
|
|
2886
2886
|
}
|
|
2887
2887
|
|
|
2888
|
-
var keysIn_1 = keysIn
|
|
2888
|
+
var keysIn_1 = keysIn;
|
|
2889
2889
|
|
|
2890
2890
|
/**
|
|
2891
2891
|
* The base implementation of `_.assignIn` without support for multiple sources
|
|
@@ -3664,7 +3664,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
3664
3664
|
|
|
3665
3665
|
var keysFunc = isFull
|
|
3666
3666
|
? (isFlat ? _getAllKeysIn : _getAllKeys)
|
|
3667
|
-
: (isFlat ?
|
|
3667
|
+
: (isFlat ? keysIn_1 : keys_1);
|
|
3668
3668
|
|
|
3669
3669
|
var props = isArr ? undefined : keysFunc(value);
|
|
3670
3670
|
_arrayEach(props || value, function(subValue, key) {
|
|
@@ -5263,10 +5263,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
5263
5263
|
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
|
|
5264
5264
|
return false;
|
|
5265
5265
|
}
|
|
5266
|
-
//
|
|
5267
|
-
var
|
|
5268
|
-
|
|
5269
|
-
|
|
5266
|
+
// Check that cyclic values are equal.
|
|
5267
|
+
var arrStacked = stack.get(array);
|
|
5268
|
+
var othStacked = stack.get(other);
|
|
5269
|
+
if (arrStacked && othStacked) {
|
|
5270
|
+
return arrStacked == other && othStacked == array;
|
|
5270
5271
|
}
|
|
5271
5272
|
var index = -1,
|
|
5272
5273
|
result = true,
|
|
@@ -5501,10 +5502,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
5501
5502
|
return false;
|
|
5502
5503
|
}
|
|
5503
5504
|
}
|
|
5504
|
-
//
|
|
5505
|
-
var
|
|
5506
|
-
|
|
5507
|
-
|
|
5505
|
+
// Check that cyclic values are equal.
|
|
5506
|
+
var objStacked = stack.get(object);
|
|
5507
|
+
var othStacked = stack.get(other);
|
|
5508
|
+
if (objStacked && othStacked) {
|
|
5509
|
+
return objStacked == other && othStacked == object;
|
|
5508
5510
|
}
|
|
5509
5511
|
var result = true;
|
|
5510
5512
|
stack.set(object, other);
|
|
@@ -14153,7 +14155,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
14153
14155
|
if (options.anchor === "none") {
|
|
14154
14156
|
this.autoAnchor = autoAnchor || "bottom";
|
|
14155
14157
|
this.containerDiv.classList.add(this.autoAnchor);
|
|
14156
|
-
marker = new
|
|
14158
|
+
marker = new maplibregl.Marker({
|
|
14157
14159
|
anchor: this.autoAnchor,
|
|
14158
14160
|
element: this.containerDiv,
|
|
14159
14161
|
offset: options.pixelOffset,
|
|
@@ -14161,7 +14163,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
14161
14163
|
}
|
|
14162
14164
|
else {
|
|
14163
14165
|
this.containerDiv.classList.add(options.anchor);
|
|
14164
|
-
marker = new
|
|
14166
|
+
marker = new maplibregl.Marker({
|
|
14165
14167
|
anchor: options.anchor,
|
|
14166
14168
|
element: this.containerDiv,
|
|
14167
14169
|
offset: options.pixelOffset,
|
|
@@ -14557,7 +14559,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
14557
14559
|
if (!options.visible) {
|
|
14558
14560
|
this.element.classList.add(HtmlMarker.hiddenClass);
|
|
14559
14561
|
}
|
|
14560
|
-
this.marker = new
|
|
14562
|
+
this.marker = new maplibregl.Marker({
|
|
14561
14563
|
element: this.element,
|
|
14562
14564
|
offset: options.pixelOffset,
|
|
14563
14565
|
draggable: options.draggable,
|
|
@@ -15302,13 +15304,13 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
15302
15304
|
* Gets the worker count that will get created.
|
|
15303
15305
|
*/
|
|
15304
15306
|
function getWorkerCount() {
|
|
15305
|
-
return
|
|
15307
|
+
return maplibregl.workerCount;
|
|
15306
15308
|
}
|
|
15307
15309
|
/**
|
|
15308
15310
|
* Gets the Maximum number of images (raster tiles, sprites, icons) to load in parallel
|
|
15309
15311
|
*/
|
|
15310
15312
|
function getMaxParallelImageRequests() {
|
|
15311
|
-
return
|
|
15313
|
+
return maplibregl.maxParallelImageRequests;
|
|
15312
15314
|
}
|
|
15313
15315
|
/**
|
|
15314
15316
|
* Gets the default language that was provided.
|
|
@@ -15361,7 +15363,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
15361
15363
|
if (UserAgent.isIE()) {
|
|
15362
15364
|
return false;
|
|
15363
15365
|
}
|
|
15364
|
-
return
|
|
15366
|
+
return maplibregl.supported({
|
|
15365
15367
|
failIfMajorPerformanceCaveat: failIfMajorPerformanceCaveat
|
|
15366
15368
|
});
|
|
15367
15369
|
}
|
|
@@ -15420,7 +15422,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
15420
15422
|
*/
|
|
15421
15423
|
function setWorkerCount(workerCount) {
|
|
15422
15424
|
if (workerCount > 0) {
|
|
15423
|
-
|
|
15425
|
+
maplibregl.workerCount = workerCount;
|
|
15424
15426
|
hasWorkerCount = true;
|
|
15425
15427
|
}
|
|
15426
15428
|
}
|
|
@@ -15431,7 +15433,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
15431
15433
|
*/
|
|
15432
15434
|
function setMaxParallelImageRequests(maxParallelImageRequests) {
|
|
15433
15435
|
if (maxParallelImageRequests > 0) {
|
|
15434
|
-
|
|
15436
|
+
maplibregl.maxParallelImageRequests = maxParallelImageRequests;
|
|
15435
15437
|
hasMaxParallelImageRequests = true;
|
|
15436
15438
|
}
|
|
15437
15439
|
}
|
|
@@ -15546,7 +15548,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
15546
15548
|
* created and destroyed.
|
|
15547
15549
|
*/
|
|
15548
15550
|
function prewarm() {
|
|
15549
|
-
|
|
15551
|
+
maplibregl.prewarm();
|
|
15550
15552
|
}
|
|
15551
15553
|
/**
|
|
15552
15554
|
* Clears up resources that have previously been created by `atlas.prewarm()`.
|
|
@@ -15555,7 +15557,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
15555
15557
|
* in your application.
|
|
15556
15558
|
*/
|
|
15557
15559
|
function clearPrewarmedResources() {
|
|
15558
|
-
|
|
15560
|
+
maplibregl.clearPrewarmedResources();
|
|
15559
15561
|
}
|
|
15560
15562
|
/**
|
|
15561
15563
|
* Returns if authentication options are set.
|
|
@@ -16054,6 +16056,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
16054
16056
|
40
|
|
16055
16057
|
];
|
|
16056
16058
|
// accessibility recommendation: After using any of the map shortcut keys, NVDA should not read all the shortcut keys again.
|
|
16059
|
+
// // TODO: this should be this.map._getMap().getCanvas
|
|
16057
16060
|
var mapCanvas = _this.map._getMap()._canvas;
|
|
16058
16061
|
mapCanvas === null || mapCanvas === void 0 ? void 0 : mapCanvas.addEventListener('keyup', function (event) {
|
|
16059
16062
|
if (baseShortcutKeyCodes.find(function (code) { return event.keyCode === code; })) {
|
|
@@ -19882,10 +19885,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
19882
19885
|
*/
|
|
19883
19886
|
LayerGroupComparator.getLayerGroup = function (layer) {
|
|
19884
19887
|
var _a;
|
|
19885
|
-
|
|
19886
|
-
|
|
19888
|
+
var layerObject = layer;
|
|
19889
|
+
if ((layerObject === null || layerObject === void 0 ? void 0 : layerObject.metadata) && layerObject.metadata['microsoft.maps:layerGroup']) {
|
|
19890
|
+
return layerObject.metadata['microsoft.maps:layerGroup'];
|
|
19887
19891
|
}
|
|
19888
|
-
var layerId = (_a =
|
|
19892
|
+
var layerId = (_a = layerObject === null || layerObject === void 0 ? void 0 : layerObject.id) !== null && _a !== void 0 ? _a : layer;
|
|
19889
19893
|
if (!layerId.startsWith("microsoft.")) {
|
|
19890
19894
|
return undefined;
|
|
19891
19895
|
}
|
|
@@ -20339,16 +20343,163 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
20339
20343
|
}
|
|
20340
20344
|
throw Error("Style definition does not contain neither URL nor style object.");
|
|
20341
20345
|
};
|
|
20346
|
+
StyleManager.prototype.deriveNewStyle = function (previousStyle, nextStyle) {
|
|
20347
|
+
// Layers in the next style with default properties that do not align with current StyleOptions
|
|
20348
|
+
// should be modified before they are applied to the map.
|
|
20349
|
+
var styleOptions = this.map.getStyle();
|
|
20350
|
+
var trafficOptions = this.map.getTraffic();
|
|
20351
|
+
return __assign$8(__assign$8({}, nextStyle), {
|
|
20352
|
+
// force a replacement of language placeholder in the tileset url to avoid resolution to a same cache with placeholders on language change
|
|
20353
|
+
sources: Object.entries(nextStyle.sources).reduce(function (newSources, _a) {
|
|
20354
|
+
var _b = __read$c(_a, 2), sourceKey = _b[0], source = _b[1];
|
|
20355
|
+
var newSource = __assign$8({}, source);
|
|
20356
|
+
if ('url' in newSource && typeof newSource.url === 'string') {
|
|
20357
|
+
if (newSource.url.includes(constants.languagePlaceHolder)) {
|
|
20358
|
+
newSource.url = newSource.url.replace(constants.languagePlaceHolder, styleOptions.language);
|
|
20359
|
+
}
|
|
20360
|
+
}
|
|
20361
|
+
newSources[sourceKey] = newSource;
|
|
20362
|
+
return newSources;
|
|
20363
|
+
}, {}), layers: nextStyle.layers.map(function (layer) {
|
|
20364
|
+
var _a, _b, _c, _d, _e, _f;
|
|
20365
|
+
var nextLayer = __assign$8({}, layer);
|
|
20366
|
+
var layerGroup = LayerGroupComparator.getLayerGroup(nextLayer);
|
|
20367
|
+
if (!layerGroup) {
|
|
20368
|
+
return nextLayer;
|
|
20369
|
+
}
|
|
20370
|
+
// 1. Set visiblity of fill-extrusion layers according to StyleOptions.showBuildingModels
|
|
20371
|
+
if (!styleOptions.showBuildingModels && nextLayer.type === "fill-extrusion") {
|
|
20372
|
+
nextLayer.layout = (_a = nextLayer.layout) !== null && _a !== void 0 ? _a : {};
|
|
20373
|
+
nextLayer.layout.visibility = "none";
|
|
20374
|
+
}
|
|
20375
|
+
else if (nextLayer.type === "fill-extrusion") {
|
|
20376
|
+
nextLayer.layout = (_b = nextLayer.layout) !== null && _b !== void 0 ? _b : {};
|
|
20377
|
+
nextLayer.layout.visibility = "visible";
|
|
20378
|
+
}
|
|
20379
|
+
// 2. Set visibility of traffic layers depending on traffic settings.
|
|
20380
|
+
if (trafficOptions.flow !== "none" && layerGroup) {
|
|
20381
|
+
if (layerGroup === "traffic_" + trafficOptions.flow && nextLayer.type == "line") {
|
|
20382
|
+
nextLayer.layout = (_c = nextLayer.layout) !== null && _c !== void 0 ? _c : {};
|
|
20383
|
+
nextLayer.layout.visibility = "visible";
|
|
20384
|
+
}
|
|
20385
|
+
}
|
|
20386
|
+
// 3. Set visibility of labels
|
|
20387
|
+
var isLabelLayerGroup = layerGroup === 'labels' || layerGroup === 'labels_places' || layerGroup === 'labels_indoor';
|
|
20388
|
+
if (isLabelLayerGroup && nextLayer.type === 'symbol') {
|
|
20389
|
+
if (styleOptions.showLabels && ((_d = nextLayer.layout) === null || _d === void 0 ? void 0 : _d.visibility) !== "none") {
|
|
20390
|
+
nextLayer.layout = (_e = nextLayer.layout) !== null && _e !== void 0 ? _e : {};
|
|
20391
|
+
nextLayer.layout.visibility = "visible";
|
|
20392
|
+
}
|
|
20393
|
+
else {
|
|
20394
|
+
nextLayer.layout = (_f = nextLayer.layout) !== null && _f !== void 0 ? _f : {};
|
|
20395
|
+
nextLayer.layout.visibility = "none";
|
|
20396
|
+
}
|
|
20397
|
+
}
|
|
20398
|
+
return nextLayer;
|
|
20399
|
+
}) });
|
|
20400
|
+
};
|
|
20401
|
+
StyleManager.prototype.injectUserLayersIntoStyle = function (previousStyle, nextStyle, layerGroupLayers) {
|
|
20402
|
+
// Custom layers added to mapbox through this SDK should be carried over to the next style.
|
|
20403
|
+
return !previousStyle
|
|
20404
|
+
? nextStyle
|
|
20405
|
+
: this.map.layers._getUserLayers().reduce(function (style, userLayer) {
|
|
20406
|
+
if (userLayer.layer instanceof WebGLLayer) {
|
|
20407
|
+
// mapbox custom layers cannot be serialized and preserved,
|
|
20408
|
+
// return to continue to the next user layer.
|
|
20409
|
+
return style;
|
|
20410
|
+
}
|
|
20411
|
+
var before = layerGroupLayers[userLayer.before] && layerGroupLayers[userLayer.before].length > 0
|
|
20412
|
+
? layerGroupLayers[userLayer.before][0]
|
|
20413
|
+
: undefined;
|
|
20414
|
+
var layer = previousStyle.layers.find(function (layer) { return layer.id === userLayer.layer.getId(); });
|
|
20415
|
+
// when setStyle diff attempt is unsuccesful, _load will be called on the style that may have already injected user layers -> clean it up
|
|
20416
|
+
var existingLayerIdx = nextStyle.layers.findIndex(function (layer) { return layer.id === userLayer.layer.getId(); });
|
|
20417
|
+
if (existingLayerIdx > -1) {
|
|
20418
|
+
nextStyle.layers.splice(existingLayerIdx, 1);
|
|
20419
|
+
}
|
|
20420
|
+
if (layer) {
|
|
20421
|
+
var sourcesToCopy = new Set(Array.from(userLayer.layer._getSourceIds())
|
|
20422
|
+
.map(function (sourceId) { return previousStyle.sources[sourceId] ? { source: previousStyle.sources[sourceId], id: sourceId } : undefined; })
|
|
20423
|
+
.filter(function (source) { return source !== undefined; }));
|
|
20424
|
+
var insertIdx = before ? style.layers.findIndex(function (layer) { return layer.id === before.id; }) : -1;
|
|
20425
|
+
if (insertIdx > -1) {
|
|
20426
|
+
style.layers.splice(insertIdx, 0, layer);
|
|
20427
|
+
}
|
|
20428
|
+
else {
|
|
20429
|
+
style.layers.push(layer);
|
|
20430
|
+
}
|
|
20431
|
+
sourcesToCopy.forEach(function (_a) {
|
|
20432
|
+
var source = _a.source, id = _a.id;
|
|
20433
|
+
style.sources[id] = source;
|
|
20434
|
+
});
|
|
20435
|
+
}
|
|
20436
|
+
return style;
|
|
20437
|
+
}, __assign$8({}, nextStyle));
|
|
20438
|
+
};
|
|
20342
20439
|
/**
|
|
20343
20440
|
* @internal
|
|
20344
20441
|
*/
|
|
20345
20442
|
StyleManager.prototype.setStyle = function (styleOptions, diff) {
|
|
20443
|
+
var _this = this;
|
|
20346
20444
|
if (diff === void 0) { diff = true; }
|
|
20347
20445
|
try {
|
|
20348
20446
|
this.map._getMap().setStyle(this.getStyle(styleOptions), {
|
|
20349
20447
|
diff: diff,
|
|
20350
|
-
|
|
20351
|
-
|
|
20448
|
+
validate: this.serviceOptions.validateStyle,
|
|
20449
|
+
transformStyle: function (previousStyle, nextStyle) {
|
|
20450
|
+
// 1. derive the base new style (without user layers)
|
|
20451
|
+
var targetStyle = _this.deriveNewStyle(previousStyle, nextStyle);
|
|
20452
|
+
// 2. derive layer groups for the new style
|
|
20453
|
+
var layerGroupLayers = targetStyle.layers
|
|
20454
|
+
.map(function (nextLayer) { return ({ nextLayer: nextLayer, layerGroup: LayerGroupComparator.getLayerGroup(nextLayer) }); })
|
|
20455
|
+
.filter(function (_a) {
|
|
20456
|
+
var nextLayer = _a.nextLayer, layerGroup = _a.layerGroup;
|
|
20457
|
+
return layerGroup !== undefined;
|
|
20458
|
+
})
|
|
20459
|
+
.reduce(function (layerGroupLayers, _a) {
|
|
20460
|
+
var _b;
|
|
20461
|
+
var nextLayer = _a.nextLayer, layerGroup = _a.layerGroup;
|
|
20462
|
+
return (__assign$8(__assign$8({}, layerGroupLayers), (_b = {}, _b[layerGroup] = layerGroup in layerGroupLayers ? __spreadArray$6(__spreadArray$6([], __read$c(layerGroupLayers[layerGroup])), [nextLayer]) : [nextLayer], _b)));
|
|
20463
|
+
}, {});
|
|
20464
|
+
// 3. side effect: progressively render map layers to the canvas to shorten the time to the first meaningful render.
|
|
20465
|
+
var shouldProgressiveLoading = (styleOptions.progressiveLoading &&
|
|
20466
|
+
// The feature only effective at the initial load.
|
|
20467
|
+
!_this.map._isLoaded());
|
|
20468
|
+
if (shouldProgressiveLoading) {
|
|
20469
|
+
var initLayerGroups = styleOptions.progressiveLoadingInitialLayerGroups;
|
|
20470
|
+
if (Array.isArray(initLayerGroups) && initLayerGroups.length > 0) {
|
|
20471
|
+
_this._deferLayerGroupVisibilities(layerGroupLayers, initLayerGroups);
|
|
20472
|
+
}
|
|
20473
|
+
}
|
|
20474
|
+
// 4. copy user layers and sources from previous style into new one
|
|
20475
|
+
var targetStyleWithUserLayers = _this.injectUserLayersIntoStyle(previousStyle, nextStyle, layerGroupLayers);
|
|
20476
|
+
// 5. side effects: sync our control's LayerManager and SourceManager
|
|
20477
|
+
var nextFundamentalLayers = Object.entries(layerGroupLayers).map(function (_a) {
|
|
20478
|
+
var _b = __read$c(_a, 2), layerGroupId = _b[0], layers = _b[1];
|
|
20479
|
+
return _this._buildFundamentalLayerFrom(layers, layerGroupId);
|
|
20480
|
+
});
|
|
20481
|
+
var layerIndex = _this.map.layers._getUserLayers().reduce(function (layerIndex, userLayer) {
|
|
20482
|
+
var layerInsertIndex = userLayer.before ? layerIndex.findIndex(function (layer) { return layer.getId() === userLayer.before; }) : -1;
|
|
20483
|
+
if (layerInsertIndex > -1) {
|
|
20484
|
+
layerIndex.splice(layerInsertIndex, 0, userLayer.layer);
|
|
20485
|
+
}
|
|
20486
|
+
else {
|
|
20487
|
+
layerIndex.push(userLayer.layer);
|
|
20488
|
+
}
|
|
20489
|
+
return layerIndex;
|
|
20490
|
+
}, nextFundamentalLayers);
|
|
20491
|
+
_this.map.layers['layerIndex'] = layerIndex;
|
|
20492
|
+
_this.map.sources._syncSources(targetStyleWithUserLayers.sources);
|
|
20493
|
+
// 5. temporarily patch style data event
|
|
20494
|
+
// FIXME: below diffing will be soon fixed on the maplibre side
|
|
20495
|
+
// If there was a previous styledata change event attached, remove it.
|
|
20496
|
+
// When the sprite url changes between style changes then maplibre can't perform the diff
|
|
20497
|
+
// In such cases it recalculate the style again. Removing previous attached
|
|
20498
|
+
// event listener makes sure that style changed event is not fired twice in these cases.
|
|
20499
|
+
_this.map.events.remove("styledata", _this._onStyleData);
|
|
20500
|
+
_this.map.events.addOnce("styledata", _this._onStyleData);
|
|
20501
|
+
return targetStyleWithUserLayers;
|
|
20502
|
+
}
|
|
20352
20503
|
});
|
|
20353
20504
|
}
|
|
20354
20505
|
catch (e) {
|
|
@@ -20418,145 +20569,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
20418
20569
|
StyleManager.prototype.clearStyleSet = function () {
|
|
20419
20570
|
this.unsetIndoorState();
|
|
20420
20571
|
};
|
|
20421
|
-
/**
|
|
20422
|
-
* Function invoked by mapbox after a style is fetched but before it is committed to the map state.
|
|
20423
|
-
*
|
|
20424
|
-
* @param previousStyle The current style.
|
|
20425
|
-
* @param nextStyle The next style which is to be applied.
|
|
20426
|
-
* @param preserveLayer Preserve a layer from the previous style in the next style.
|
|
20427
|
-
* @param updatePaintProperty Modify paint properties of a layer in the next style before the style is applied.
|
|
20428
|
-
* @param updateLayoutProperty Modify layout properties of a layer in the next style before the style is applied.
|
|
20429
|
-
* @param updateFilter Modify filter property of a layer in the next style before the style is applied.
|
|
20430
|
-
*/
|
|
20431
|
-
StyleManager.prototype._stylePatch = function (previousStyle, nextStyle, preserveLayer, updatePaintProperty, updateLayoutProperty, updateFilter) {
|
|
20432
|
-
var _this = this;
|
|
20433
|
-
// Layers in the next style with default properties that do not align with current StyleOptions
|
|
20434
|
-
// should be modified before they are applied to the map.
|
|
20435
|
-
var styleOptions = this.map.getStyle();
|
|
20436
|
-
var trafficOptions = this.map.getTraffic();
|
|
20437
|
-
// force a replacement of language placeholder in the tileset url to avoid resolution to a same cache with placeholders on language change
|
|
20438
|
-
nextStyle.sources = Object.entries(nextStyle.sources).reduce(function (newSources, _a) {
|
|
20439
|
-
var _b = __read$c(_a, 2), sourceKey = _b[0], source = _b[1];
|
|
20440
|
-
var newSource = __assign$8({}, source);
|
|
20441
|
-
if ('url' in newSource && typeof newSource.url === 'string') {
|
|
20442
|
-
if (newSource.url.includes(constants.languagePlaceHolder)) {
|
|
20443
|
-
newSource.url = newSource.url.replace(constants.languagePlaceHolder, styleOptions.language);
|
|
20444
|
-
}
|
|
20445
|
-
}
|
|
20446
|
-
newSources[sourceKey] = newSource;
|
|
20447
|
-
return newSources;
|
|
20448
|
-
}, {});
|
|
20449
|
-
var shouldProgressiveLoading = (styleOptions.progressiveLoading &&
|
|
20450
|
-
// The feature only effective at the initial load.
|
|
20451
|
-
!this.map._isLoaded());
|
|
20452
|
-
var setLayerVisibility = function (layer, visibility) {
|
|
20453
|
-
var _a;
|
|
20454
|
-
if (!shouldProgressiveLoading) {
|
|
20455
|
-
// No need to apply the visibility change to maplibre while progressive loading is enabled.
|
|
20456
|
-
// This can save a lot of CPU time.
|
|
20457
|
-
updateLayoutProperty(layer.id, 'visibility', visibility);
|
|
20458
|
-
}
|
|
20459
|
-
layer.layout = (_a = layer.layout) !== null && _a !== void 0 ? _a : {};
|
|
20460
|
-
layer.layout.visibility = visibility;
|
|
20461
|
-
};
|
|
20462
|
-
var layerGroupLayers = {};
|
|
20463
|
-
nextStyle.layers.forEach(function (nextLayer) {
|
|
20464
|
-
var _a;
|
|
20465
|
-
var layerGroup = LayerGroupComparator.getLayerGroup(nextLayer);
|
|
20466
|
-
if (layerGroup) {
|
|
20467
|
-
// Set visibility of fill-extrusion layers according to StyleOptions.showBuildingModels
|
|
20468
|
-
if (nextLayer.type === 'fill-extrusion') {
|
|
20469
|
-
setLayerVisibility(nextLayer, styleOptions.showBuildingModels ? 'visible' : 'none');
|
|
20470
|
-
}
|
|
20471
|
-
// Set visibility of traffic layers depending on traffic settings.
|
|
20472
|
-
if (trafficOptions.flow !== 'none' &&
|
|
20473
|
-
layerGroup === "traffic_" + trafficOptions.flow &&
|
|
20474
|
-
nextLayer.type == 'line') {
|
|
20475
|
-
setLayerVisibility(nextLayer, 'visible');
|
|
20476
|
-
}
|
|
20477
|
-
// Set visibility of labels
|
|
20478
|
-
var isLabelLayerGroup = layerGroup === 'labels' || layerGroup === 'labels_places' || layerGroup === 'labels_indoor';
|
|
20479
|
-
if (isLabelLayerGroup && nextLayer.type === 'symbol') {
|
|
20480
|
-
var isLayerVisible = ((_a = nextLayer.layout) === null || _a === void 0 ? void 0 : _a.visibility) !== 'none';
|
|
20481
|
-
setLayerVisibility(nextLayer, isLayerVisible && styleOptions.showLabels ? 'visible' : 'none');
|
|
20482
|
-
}
|
|
20483
|
-
// Once this _stylePatch returns control to maplibre the next style will be applied immediately in the same context.
|
|
20484
|
-
// To avoid potential data races update LayerManager with new a new set of FundamentalMapLayers from here instead of
|
|
20485
|
-
// waiting for a styledata.load event to trigger a sync in a different context.
|
|
20486
|
-
if (layerGroupLayers[layerGroup]) {
|
|
20487
|
-
layerGroupLayers[layerGroup].push(nextLayer);
|
|
20488
|
-
}
|
|
20489
|
-
else {
|
|
20490
|
-
layerGroupLayers[layerGroup] = [nextLayer];
|
|
20491
|
-
}
|
|
20492
|
-
}
|
|
20493
|
-
});
|
|
20494
|
-
if (shouldProgressiveLoading) {
|
|
20495
|
-
var initLayerGroups = styleOptions.progressiveLoadingInitialLayerGroups;
|
|
20496
|
-
if (Array.isArray(initLayerGroups) && initLayerGroups.length > 0) {
|
|
20497
|
-
this._deferLayerGroupVisibilities(layerGroupLayers, initLayerGroups);
|
|
20498
|
-
}
|
|
20499
|
-
}
|
|
20500
|
-
// A FundamentalMapLayer (grouped layer) representation of the next style must be built.
|
|
20501
|
-
var previousLayers = this.map.layers.getLayers();
|
|
20502
|
-
var nextLayers = Object.entries(layerGroupLayers).map(function (_a) {
|
|
20503
|
-
var _b = __read$c(_a, 2), layerGroupName = _b[0], layerGroupMapboxLayers = _b[1];
|
|
20504
|
-
return _this._buildFundamentalLayerFrom(layerGroupMapboxLayers, layerGroupName);
|
|
20505
|
-
});
|
|
20506
|
-
// Update FundamentalMapLayers in LayerManager
|
|
20507
|
-
var userLayers = this.map.layers._getUserLayers();
|
|
20508
|
-
var layersToRemove = previousLayers.filter(function (c) {
|
|
20509
|
-
return (nextLayers.findIndex(function (n) { return c.getId() === n.getId(); }) < 0 &&
|
|
20510
|
-
userLayers.findIndex(function (n) { return c.getId() === n.layer.getId(); }) < 0);
|
|
20511
|
-
});
|
|
20512
|
-
var prevNextIntersection = nextLayers.filter(function (n) { return previousLayers.find(function (c) { return c.getId() === n.getId(); }); });
|
|
20513
|
-
var ePrevNextIntersection = prevNextIntersection.entries();
|
|
20514
|
-
var replace = ePrevNextIntersection.next();
|
|
20515
|
-
nextLayers.forEach(function (newFundamentalLayer) {
|
|
20516
|
-
if (replace.value && replace.value[1].getId() === newFundamentalLayer.getId()) {
|
|
20517
|
-
// Replace the existing layer with this ID with the new one.
|
|
20518
|
-
var insertBefore = previousLayers.findIndex(function (l) { return l.getId() === newFundamentalLayer.getId(); });
|
|
20519
|
-
_this.map.layers.remove(newFundamentalLayer.getId());
|
|
20520
|
-
_this.map.layers.add(newFundamentalLayer, previousLayers[insertBefore].getId());
|
|
20521
|
-
replace = ePrevNextIntersection.next();
|
|
20522
|
-
}
|
|
20523
|
-
else {
|
|
20524
|
-
if (replace.value) {
|
|
20525
|
-
// Insert new layer before the next common layer.
|
|
20526
|
-
_this.map.layers.add(newFundamentalLayer, replace.value[1]);
|
|
20527
|
-
}
|
|
20528
|
-
else {
|
|
20529
|
-
_this.map.layers.add(newFundamentalLayer);
|
|
20530
|
-
}
|
|
20531
|
-
}
|
|
20532
|
-
});
|
|
20533
|
-
layersToRemove.forEach(function (layer) {
|
|
20534
|
-
_this.map.layers.remove(layer);
|
|
20535
|
-
});
|
|
20536
|
-
// Layers added to mapbox through this SDK since loading the last style should be
|
|
20537
|
-
// carried over to the next style.
|
|
20538
|
-
userLayers.forEach(function (userLayer) {
|
|
20539
|
-
if (userLayer.layer instanceof WebGLLayer) {
|
|
20540
|
-
// mapbox custom layers cannot be serialized and preserved,
|
|
20541
|
-
// return to continue to the next user layer.
|
|
20542
|
-
return;
|
|
20543
|
-
}
|
|
20544
|
-
var before = undefined;
|
|
20545
|
-
if (_this.map.layers.getLayerById(userLayer.before)) {
|
|
20546
|
-
var beforeCandidates = _this.map.layers.getLayerById(userLayer.before)._buildLayers();
|
|
20547
|
-
before = (beforeCandidates.length > 0) ? beforeCandidates[0] : undefined;
|
|
20548
|
-
}
|
|
20549
|
-
preserveLayer(userLayer.layer.getId(), before === null || before === void 0 ? void 0 : before.id);
|
|
20550
|
-
_this.map.layers.move(userLayer.layer, userLayer.before);
|
|
20551
|
-
});
|
|
20552
|
-
this.map.sources._syncSources(nextStyle.sources);
|
|
20553
|
-
// If there was a previous styledata change event attached, remove it.
|
|
20554
|
-
// When the sprite url changes between style changes then mapbox can't perform the diff
|
|
20555
|
-
// In such cases it recalculate the style again. Removing previous attached
|
|
20556
|
-
// event listener makes sure that style changed event is not fired twice in these cases.
|
|
20557
|
-
this.map.events.remove("styledata", this._onStyleData);
|
|
20558
|
-
this.map.events.addOnce("styledata", this._onStyleData);
|
|
20559
|
-
};
|
|
20560
20572
|
StyleManager.prototype._buildFundamentalLayerFrom = function (layers, id) {
|
|
20561
20573
|
if (layers && layers.length > 0) {
|
|
20562
20574
|
var newLayer = new FundamentalMapLayer(layers, id);
|
|
@@ -20822,10 +20834,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
20822
20834
|
if (_this.serviceOptions.transformRequest) {
|
|
20823
20835
|
merge_1(requestParams, _this.serviceOptions.transformRequest(requestParams.url, resourceType));
|
|
20824
20836
|
}
|
|
20837
|
+
// TODO: fix type variation
|
|
20825
20838
|
return requestParams;
|
|
20826
20839
|
}
|
|
20827
20840
|
};
|
|
20828
|
-
mapboxMap = new
|
|
20841
|
+
mapboxMap = new maplibregl.Map(mapboxMapOptions);
|
|
20829
20842
|
}
|
|
20830
20843
|
try {
|
|
20831
20844
|
_this.map = mapboxMap;
|
|
@@ -20987,6 +21000,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
20987
21000
|
*/
|
|
20988
21001
|
Map.prototype.removeRequestTransformer = function (transformer) { this.serviceOptions.removeTransformer(transformer); };
|
|
20989
21002
|
Map.prototype.setCamera = function (options, fromControl) {
|
|
21003
|
+
var _a;
|
|
20990
21004
|
if (fromControl === void 0) { fromControl = false; }
|
|
20991
21005
|
var mapboxCameraOptions;
|
|
20992
21006
|
var maxBounds;
|
|
@@ -20995,13 +21009,22 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
20995
21009
|
var cameraBoundsOptions = new CameraBoundsOptions()
|
|
20996
21010
|
.merge({ maxZoom: this.getCamera().maxZoom }, options);
|
|
20997
21011
|
var bounds = this._generateSafeBounds(cameraBoundsOptions.bounds);
|
|
20998
|
-
|
|
21012
|
+
var cameraForBoundsOptions = {
|
|
20999
21013
|
padding: cameraBoundsOptions.padding,
|
|
21000
21014
|
offset: cameraBoundsOptions.offset,
|
|
21001
21015
|
maxZoom: cameraBoundsOptions.maxZoom
|
|
21002
|
-
}
|
|
21016
|
+
};
|
|
21017
|
+
mapboxCameraOptions = this.map.cameraForBounds(bounds, cameraForBoundsOptions);
|
|
21003
21018
|
if (!mapboxCameraOptions) {
|
|
21004
|
-
|
|
21019
|
+
var currentContainer = (_a = this.map) === null || _a === void 0 ? void 0 : _a.getContainer();
|
|
21020
|
+
var errorDetails = {
|
|
21021
|
+
message: "The map cannot be fit to the current canvas with the given CameraBoundsOptions.",
|
|
21022
|
+
containerWidth: currentContainer === null || currentContainer === void 0 ? void 0 : currentContainer.clientWidth,
|
|
21023
|
+
containerHeight: currentContainer === null || currentContainer === void 0 ? void 0 : currentContainer.clientHeight,
|
|
21024
|
+
safeBounds: bounds,
|
|
21025
|
+
cameraForBoundsOptions: cameraForBoundsOptions
|
|
21026
|
+
};
|
|
21027
|
+
throw new Error(JSON.stringify(errorDetails));
|
|
21005
21028
|
}
|
|
21006
21029
|
this.map.setMaxZoom(cameraBoundsOptions.maxZoom);
|
|
21007
21030
|
this._invokeEvent("maxzoomchanged", this.map.getMaxZoom());
|
|
@@ -22585,7 +22608,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
22585
22608
|
domain: env.staticAssetsDomain,
|
|
22586
22609
|
path: "sdk/javascript/mapcontrol/" + Version.getEndpointVersion() + "/mapbox-gl-rtl-text.min.js"
|
|
22587
22610
|
});
|
|
22588
|
-
|
|
22611
|
+
maplibregl.setRTLTextPlugin(rtlPluginUrl.toString(), function (error) {
|
|
22589
22612
|
if (error) {
|
|
22590
22613
|
console.warn(error);
|
|
22591
22614
|
}
|