adt-js-components 1.10.7 → 1.10.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/package.json +1 -1
- package/src/Map/index.js +17 -6
package/package.json
CHANGED
package/src/Map/index.js
CHANGED
|
@@ -375,7 +375,11 @@ function addMarkers(map, markers, options, selectedOptions, position, selectable
|
|
|
375
375
|
}
|
|
376
376
|
|
|
377
377
|
if (!position.length && positionsOfMarkers.length) {
|
|
378
|
-
|
|
378
|
+
const rs = routeSettingsMap.get(map);
|
|
379
|
+
const allBounds = [...positionsOfMarkers];
|
|
380
|
+
if (rs?.startPoint) allBounds.push([rs.startPoint.lat, rs.startPoint.lon]);
|
|
381
|
+
if (rs?.endPoint) allBounds.push([rs.endPoint.lat, rs.endPoint.lon]);
|
|
382
|
+
map.fitBounds(allBounds);
|
|
379
383
|
}
|
|
380
384
|
map.addLayer(cluster);
|
|
381
385
|
|
|
@@ -392,16 +396,23 @@ function checkAndApplyPreselection(map, markers, showSelectionOrder, onSelection
|
|
|
392
396
|
}
|
|
393
397
|
}
|
|
394
398
|
|
|
395
|
-
function applyPreselectedMarkersVisualOnly(map, markersData) {
|
|
399
|
+
async function applyPreselectedMarkersVisualOnly(map, markersData) {
|
|
396
400
|
const markerMap = markerInstances.get(map);
|
|
401
|
+
const settings = routeSettingsMap.get(map);
|
|
397
402
|
const preselected = markersData.filter(m => m.selected === true);
|
|
398
403
|
|
|
399
|
-
|
|
404
|
+
for (const markerData of preselected) {
|
|
400
405
|
const markerInstance = markerMap.get(markerData.id);
|
|
401
406
|
if (markerInstance && markerInstance._selectedIcon) {
|
|
402
|
-
|
|
407
|
+
if (settings && settings.color) {
|
|
408
|
+
const iconUrl = markerInstance._selectedIcon.options.iconUrl;
|
|
409
|
+
const newIcon = await createMarkerIcon(map, iconUrl, null);
|
|
410
|
+
markerInstance.setIcon(newIcon);
|
|
411
|
+
} else {
|
|
412
|
+
markerInstance.setIcon(markerInstance._selectedIcon);
|
|
413
|
+
}
|
|
403
414
|
}
|
|
404
|
-
}
|
|
415
|
+
}
|
|
405
416
|
}
|
|
406
417
|
|
|
407
418
|
function createMarker(marker, options, selectedOptions, cluster = null, selectable = false, onSelectionChange = null, map = null, showSelectionOrder = false, markerInfoCallback = null) {
|
|
@@ -566,7 +577,7 @@ async function updateMarkerOrderDisplay(map, marker, orderNumber, isSelected, co
|
|
|
566
577
|
async function createMarkerIcon(map, iconUrl, orderNumber, color = null) {
|
|
567
578
|
let inlineStyle = null;
|
|
568
579
|
const settings = routeSettingsMap.get(map);
|
|
569
|
-
if ((settings && settings.
|
|
580
|
+
if ((settings && settings.color) || color) {
|
|
570
581
|
inlineStyle = `--marker-fill: ${color ?? settings.color};`;
|
|
571
582
|
}
|
|
572
583
|
|