adt-js-components 1.10.1 → 1.10.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/package.json +1 -1
- package/src/Map/index.js +13 -8
package/package.json
CHANGED
package/src/Map/index.js
CHANGED
|
@@ -760,7 +760,7 @@ function clearSelection(mapElement) {
|
|
|
760
760
|
order.clear();
|
|
761
761
|
}
|
|
762
762
|
|
|
763
|
-
function toggleMarker(mapElement, markerId, selected) {
|
|
763
|
+
async function toggleMarker(mapElement, markerId, selected, recalculate = true) {
|
|
764
764
|
const map = mapInstances.get(mapElement);
|
|
765
765
|
const markers = markerInstances.get(map);
|
|
766
766
|
const marker = markers?.get(markerId);
|
|
@@ -770,7 +770,7 @@ function toggleMarker(mapElement, markerId, selected) {
|
|
|
770
770
|
const isSelected = selectedSet.has(markerId);
|
|
771
771
|
|
|
772
772
|
if (selected && !isSelected) {
|
|
773
|
-
selectMarker(marker, map, true);
|
|
773
|
+
await selectMarker(marker, map, true);
|
|
774
774
|
} else if (!selected && isSelected) {
|
|
775
775
|
deselectMarker(marker, map, true);
|
|
776
776
|
} else {
|
|
@@ -783,7 +783,7 @@ function toggleMarker(mapElement, markerId, selected) {
|
|
|
783
783
|
}
|
|
784
784
|
|
|
785
785
|
const settings = routeSettingsMap.get(map);
|
|
786
|
-
if (settings && settings.enabled) {
|
|
786
|
+
if (recalculate && settings && settings.enabled) {
|
|
787
787
|
calculateRoute(map);
|
|
788
788
|
}
|
|
789
789
|
}
|
|
@@ -815,7 +815,9 @@ function onAfterRouteCalculation(mapElement, callbackName) {
|
|
|
815
815
|
|
|
816
816
|
function recalculateRoute(mapElement) {
|
|
817
817
|
const map = mapInstances.get(mapElement);
|
|
818
|
+
|
|
818
819
|
if (!map) return;
|
|
820
|
+
|
|
819
821
|
calculateRoute(map);
|
|
820
822
|
}
|
|
821
823
|
|
|
@@ -855,8 +857,9 @@ function removeMarker(mapElement, markerId) {
|
|
|
855
857
|
}
|
|
856
858
|
}
|
|
857
859
|
|
|
858
|
-
function addMarkerAndSelect(mapElement, markerData) {
|
|
860
|
+
function addMarkerAndSelect(mapElement, markerData, recalculate = true) {
|
|
859
861
|
const map = mapInstances.get(mapElement);
|
|
862
|
+
|
|
860
863
|
if (!map) return;
|
|
861
864
|
|
|
862
865
|
const markers = markerInstances.get(map);
|
|
@@ -898,13 +901,15 @@ function addMarkerAndSelect(mapElement, markerData) {
|
|
|
898
901
|
};
|
|
899
902
|
};
|
|
900
903
|
|
|
901
|
-
loadSelectedIcon((selectedIcon) => {
|
|
904
|
+
loadSelectedIcon(async (selectedIcon) => {
|
|
905
|
+
const mapConfig = JSON.parse(mapElement.dataset.adtMap ?? '{}');
|
|
906
|
+
const selectable = mapConfig.selectable ?? false;
|
|
902
907
|
const newMarker = createMarker(
|
|
903
908
|
markerData,
|
|
904
909
|
{ icon: normalIcon },
|
|
905
910
|
{ icon: selectedIcon },
|
|
906
911
|
cluster || null,
|
|
907
|
-
|
|
912
|
+
selectable,
|
|
908
913
|
onSelectionChangeMap.get(map),
|
|
909
914
|
map,
|
|
910
915
|
true,
|
|
@@ -916,9 +921,9 @@ function addMarkerAndSelect(mapElement, markerData) {
|
|
|
916
921
|
}
|
|
917
922
|
|
|
918
923
|
markersData.push(markerData);
|
|
919
|
-
selectMarker(newMarker, map, true);
|
|
924
|
+
await selectMarker(newMarker, map, true);
|
|
920
925
|
|
|
921
|
-
if (routeSettings?.enabled) {
|
|
926
|
+
if (recalculate && routeSettings?.enabled) {
|
|
922
927
|
calculateRoute(map);
|
|
923
928
|
}
|
|
924
929
|
});
|