@xyo-network/react-map 2.67.6 → 2.67.8
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/browser/Components/MapBoxPoints.d.cts.map +1 -1
- package/dist/browser/Components/MapBoxPoints.d.mts.map +1 -1
- package/dist/browser/Components/MapBoxPoints.d.ts.map +1 -1
- package/dist/browser/MapBoxClasses/MapHeat.d.cts.map +1 -1
- package/dist/browser/MapBoxClasses/MapHeat.d.mts.map +1 -1
- package/dist/browser/MapBoxClasses/MapHeat.d.ts.map +1 -1
- package/dist/browser/MapBoxClasses/MapPoints.d.cts.map +1 -1
- package/dist/browser/MapBoxClasses/MapPoints.d.mts.map +1 -1
- package/dist/browser/MapBoxClasses/MapPoints.d.ts.map +1 -1
- package/dist/browser/MapBoxClasses/MapSettings.d.cts.map +1 -1
- package/dist/browser/MapBoxClasses/MapSettings.d.mts.map +1 -1
- package/dist/browser/MapBoxClasses/MapSettings.d.ts.map +1 -1
- package/dist/browser/index.cjs +29 -34
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js +29 -34
- package/dist/browser/index.js.map +1 -1
- package/dist/node/Components/MapBoxPoints.d.cts.map +1 -1
- package/dist/node/Components/MapBoxPoints.d.mts.map +1 -1
- package/dist/node/Components/MapBoxPoints.d.ts.map +1 -1
- package/dist/node/MapBoxClasses/MapHeat.d.cts.map +1 -1
- package/dist/node/MapBoxClasses/MapHeat.d.mts.map +1 -1
- package/dist/node/MapBoxClasses/MapHeat.d.ts.map +1 -1
- package/dist/node/MapBoxClasses/MapPoints.d.cts.map +1 -1
- package/dist/node/MapBoxClasses/MapPoints.d.mts.map +1 -1
- package/dist/node/MapBoxClasses/MapPoints.d.ts.map +1 -1
- package/dist/node/MapBoxClasses/MapSettings.d.cts.map +1 -1
- package/dist/node/MapBoxClasses/MapSettings.d.mts.map +1 -1
- package/dist/node/MapBoxClasses/MapSettings.d.ts.map +1 -1
- package/dist/node/index.cjs +29 -34
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.js +29 -34
- package/dist/node/index.js.map +1 -1
- package/package.json +10 -10
- package/src/Components/AnimatedHeatMapLoaded.tsx +3 -3
- package/src/Components/LayerAnimator.tsx +4 -4
- package/src/Components/MapBoxPoints.tsx +5 -8
- package/src/Contexts/HeatMapInitializer/Provider.tsx +1 -1
- package/src/MapBoxClasses/MapHeat.ts +9 -8
- package/src/MapBoxClasses/MapPoints.ts +1 -0
- package/src/MapBoxClasses/MapSettings.ts +6 -10
- package/src/hooks/useDynamicPositioning.tsx +2 -2
- package/src/hooks/useQuadKeyPayloadsToFeatures.tsx +1 -1
package/dist/node/index.cjs
CHANGED
|
@@ -279,7 +279,7 @@ var useQuadKeyPayloadsToFeatures = (payloads) => {
|
|
|
279
279
|
const [error, setError] = (0, import_react4.useState)();
|
|
280
280
|
(0, import_react4.useEffect)(() => {
|
|
281
281
|
if (Array.isArray(payloads)) {
|
|
282
|
-
if ((0, import_lodash.compact)(payloads).length
|
|
282
|
+
if ((0, import_lodash.compact)(payloads).length > 0) {
|
|
283
283
|
const mappedFeatures = payloads == null ? void 0 : payloads.map((payload) => payload == null ? void 0 : payload.result.map(quadKeyToFeature));
|
|
284
284
|
setMultipleFeatureSets(mappedFeatures.map((features2) => (features2 == null ? void 0 : features2.map(setDensity)) ?? []));
|
|
285
285
|
} else {
|
|
@@ -346,11 +346,11 @@ var MapHeat = class extends MapBase {
|
|
|
346
346
|
} else {
|
|
347
347
|
bounds = new import_mapbox_gl.LngLatBounds();
|
|
348
348
|
features.forEach((feature) => {
|
|
349
|
-
feature.geometry.coordinates
|
|
350
|
-
|
|
349
|
+
for (const coordinates of feature.geometry.coordinates) {
|
|
350
|
+
for (const position of coordinates) {
|
|
351
351
|
bounds.extend(position);
|
|
352
|
-
}
|
|
353
|
-
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
354
|
});
|
|
355
355
|
}
|
|
356
356
|
map.setCenter(bounds.getCenter());
|
|
@@ -367,9 +367,9 @@ var MapHeat = class extends MapBase {
|
|
|
367
367
|
});
|
|
368
368
|
this.updateLayer(map, layers[0], sources[0]);
|
|
369
369
|
this.updateLayer(map, layers[1], sources[1]);
|
|
370
|
-
|
|
370
|
+
for (const layer of layers) {
|
|
371
371
|
map.setPaintProperty(layer.id, "fill-opacity", 0);
|
|
372
|
-
}
|
|
372
|
+
}
|
|
373
373
|
const frameLength = 3e3;
|
|
374
374
|
const initialPad = 0.5;
|
|
375
375
|
const factor = 10;
|
|
@@ -445,7 +445,7 @@ var MapHeat = class extends MapBase {
|
|
|
445
445
|
const featuresCollection = import_sdk_geo3.GeoJson.featureCollection(this.config.features);
|
|
446
446
|
return import_sdk_geo3.GeoJson.featuresSource(featuresCollection);
|
|
447
447
|
};
|
|
448
|
-
layers.
|
|
448
|
+
for (const [index, layer] of layers.entries()) {
|
|
449
449
|
const existingSource = this.config.map.getSource(layer.source);
|
|
450
450
|
const source = getSource(index);
|
|
451
451
|
if (existingSource) {
|
|
@@ -454,7 +454,7 @@ var MapHeat = class extends MapBase {
|
|
|
454
454
|
this.config.map.addSource(layer.source, source);
|
|
455
455
|
}
|
|
456
456
|
layer.update(this.config.map, true);
|
|
457
|
-
}
|
|
457
|
+
}
|
|
458
458
|
return this;
|
|
459
459
|
}
|
|
460
460
|
};
|
|
@@ -521,9 +521,11 @@ var MapSettings = class _MapSettings {
|
|
|
521
521
|
const debugEvents = ["resize", "zoomend", "dragend"];
|
|
522
522
|
if (value) {
|
|
523
523
|
this.mapListeners.logData(void 0, map);
|
|
524
|
-
|
|
524
|
+
for (const event of debugEvents)
|
|
525
|
+
map.on(event, this.mapListeners.logData);
|
|
525
526
|
} else {
|
|
526
|
-
|
|
527
|
+
for (const event of debugEvents)
|
|
528
|
+
map.off(event, this.mapListeners.logData);
|
|
527
529
|
}
|
|
528
530
|
}
|
|
529
531
|
static toggleScrollToZoom(value, map) {
|
|
@@ -555,10 +557,8 @@ var MapSettings = class _MapSettings {
|
|
|
555
557
|
});
|
|
556
558
|
this.geoLocateControl = this.geoLocateControl || geolocateControl;
|
|
557
559
|
this.navControl = this.navControl || navControl;
|
|
558
|
-
if (!map.hasControl(this.geoLocateControl)) {
|
|
559
|
-
|
|
560
|
-
map.addControl(this.geoLocateControl);
|
|
561
|
-
}
|
|
560
|
+
if (!map.hasControl(this.geoLocateControl) && requestLocation) {
|
|
561
|
+
map.addControl(this.geoLocateControl);
|
|
562
562
|
}
|
|
563
563
|
if (!map.hasControl(this.navControl)) {
|
|
564
564
|
map.addControl(this.navControl, "top-left");
|
|
@@ -566,10 +566,8 @@ var MapSettings = class _MapSettings {
|
|
|
566
566
|
return this;
|
|
567
567
|
}
|
|
568
568
|
static removeControls(map) {
|
|
569
|
-
if (this.geoLocateControl && map.hasControl(this.geoLocateControl)) {
|
|
570
|
-
|
|
571
|
-
map.removeControl(this.geoLocateControl);
|
|
572
|
-
}
|
|
569
|
+
if (this.geoLocateControl && map.hasControl(this.geoLocateControl) && this.requestLocation) {
|
|
570
|
+
map.removeControl(this.geoLocateControl);
|
|
573
571
|
}
|
|
574
572
|
if (this.navControl && map.hasControl(this.navControl)) {
|
|
575
573
|
map.removeControl(this.navControl);
|
|
@@ -672,7 +670,7 @@ var HeatMapInitializerProvider = ({
|
|
|
672
670
|
heatMapColorProps
|
|
673
671
|
};
|
|
674
672
|
(0, import_react12.useEffect)(() => {
|
|
675
|
-
if (mapInitialized && (featureSets == null ? void 0 : featureSets.length) && featureSets[0].length && map && (featureSetsLayers == null ? void 0 : featureSetsLayers.length)) {
|
|
673
|
+
if (mapInitialized && (featureSets == null ? void 0 : featureSets.length) && featureSets[0].length > 0 && map && (featureSetsLayers == null ? void 0 : featureSetsLayers.length)) {
|
|
676
674
|
const { lowUsageColor, highUsageColor } = heatMapColorProps;
|
|
677
675
|
(0, import_forget2.forget)(MapHeat.initializeAnimatedHeatMapSource(featureSetsLayers, featureSets, map, lowUsageColor, highUsageColor));
|
|
678
676
|
}
|
|
@@ -1155,7 +1153,7 @@ var AnimatedHeatMapLoaded = ({ accessToken, archivistNameOrAddress, ...props })
|
|
|
1155
1153
|
xyoError.message ? `Error: ${xyoError.message}` : null,
|
|
1156
1154
|
"You might try authenticating again."
|
|
1157
1155
|
] }) : null,
|
|
1158
|
-
hashes
|
|
1156
|
+
hashes === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_material7.Alert, { children: "Missing answer hash for heat map query" }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1159
1157
|
AnimatedHeatMap,
|
|
1160
1158
|
{
|
|
1161
1159
|
accessToken,
|
|
@@ -1165,7 +1163,7 @@ var AnimatedHeatMapLoaded = ({ accessToken, archivistNameOrAddress, ...props })
|
|
|
1165
1163
|
heatMapColorProps,
|
|
1166
1164
|
...MapBoxHeatProps
|
|
1167
1165
|
}
|
|
1168
|
-
)
|
|
1166
|
+
)
|
|
1169
1167
|
] });
|
|
1170
1168
|
};
|
|
1171
1169
|
|
|
@@ -1245,7 +1243,7 @@ var LayerAnimator = ({ animateLayers, children, layers, layersInitialized, map }
|
|
|
1245
1243
|
for (let i = 0; i < animatedLayerCount; i++) {
|
|
1246
1244
|
animatedLayers.push(getNextLayer());
|
|
1247
1245
|
}
|
|
1248
|
-
animatedLayers.
|
|
1246
|
+
for (const [index, layer] of animatedLayers.entries()) {
|
|
1249
1247
|
if (index === 0) {
|
|
1250
1248
|
layerAnimateWorker(layer);
|
|
1251
1249
|
} else {
|
|
@@ -1253,15 +1251,15 @@ var LayerAnimator = ({ animateLayers, children, layers, layersInitialized, map }
|
|
|
1253
1251
|
layerAnimateWorker(layer);
|
|
1254
1252
|
}, timeIncrement * index);
|
|
1255
1253
|
}
|
|
1256
|
-
}
|
|
1254
|
+
}
|
|
1257
1255
|
}, [getNextLayer, layerAnimateWorker]);
|
|
1258
1256
|
(0, import_react17.useEffect)(() => {
|
|
1259
|
-
if (animateLayers && layersInitialized && map && fillLayers.length) {
|
|
1257
|
+
if (animateLayers && layersInitialized && map && fillLayers.length > 0) {
|
|
1260
1258
|
queueLayerAnimation();
|
|
1261
1259
|
}
|
|
1262
1260
|
}, [animateLayers, fillLayers.length, layersInitialized, map, queueLayerAnimation]);
|
|
1263
1261
|
(0, import_react_shared4.useInterval)(() => {
|
|
1264
|
-
if (animateLayers && layersInitialized && map && fillLayers.length) {
|
|
1262
|
+
if (animateLayers && layersInitialized && map && fillLayers.length > 0) {
|
|
1265
1263
|
queueLayerAnimation();
|
|
1266
1264
|
}
|
|
1267
1265
|
}, timeIncrement * animatedLayerCount);
|
|
@@ -1293,18 +1291,15 @@ var MapboxPointsFlexBox = ({
|
|
|
1293
1291
|
return {};
|
|
1294
1292
|
};
|
|
1295
1293
|
const updateFeatures = (0, import_react18.useCallback)(() => {
|
|
1296
|
-
if ((mapPoints == null ? void 0 : mapPoints.isMapReady) && (features == null ? void 0 : features.length))
|
|
1297
|
-
|
|
1294
|
+
if ((mapPoints == null ? void 0 : mapPoints.isMapReady) && (features == null ? void 0 : features.length) && layers)
|
|
1295
|
+
for (const layer of layers) {
|
|
1298
1296
|
mapPoints.initializeMapSource(layer);
|
|
1299
|
-
}
|
|
1300
|
-
}
|
|
1297
|
+
}
|
|
1301
1298
|
}, [mapPoints, features, layers]);
|
|
1302
1299
|
const updateMapSetup = (0, import_react18.useCallback)(() => {
|
|
1303
1300
|
const { fitToPoints: fitToPoints3 } = mapSettings || {};
|
|
1304
|
-
if (mapPoints && map) {
|
|
1305
|
-
|
|
1306
|
-
mapPoints.initialMapPositioning({ padding: fitToPointsPadding, ...customFitToBoundsOptions(zoom) });
|
|
1307
|
-
}
|
|
1301
|
+
if (mapPoints && map && (fitToPoints3 == null ? void 0 : fitToPoints3.value) === true) {
|
|
1302
|
+
mapPoints.initialMapPositioning({ padding: fitToPointsPadding, ...customFitToBoundsOptions(zoom) });
|
|
1308
1303
|
}
|
|
1309
1304
|
}, [mapSettings, mapPoints, map, fitToPointsPadding, zoom]);
|
|
1310
1305
|
const reInitializeMap = (0, import_react18.useCallback)(() => {
|