adt-js-components 1.9.0 → 1.9.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/Map/index.js +28 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adt-js-components",
3
- "version": "1.9.0",
3
+ "version": "1.9.2",
4
4
  "description": "JavaScript components for Nette framework",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/Map/index.js CHANGED
@@ -356,9 +356,26 @@ function createMarker(marker, options, selectedOptions, cluster = null, selectab
356
356
  mapMarker._selectedIcon = selectedOptions.icon;
357
357
  mapMarker._markerData = marker;
358
358
 
359
+ const markerElement = mapMarker.getElement();
360
+ if (markerElement && markerElement.parentElement) {
361
+ markerElement.parentElement.style.pointerEvents = 'visible';
362
+ }
363
+
359
364
  if (map) {
360
365
  const markers = markerInstances.get(map);
361
366
  markers.set(marker.id, mapMarker);
367
+
368
+ mapMarker.on('add', function() {
369
+ const el = mapMarker.getElement();
370
+ if (el) {
371
+ el.style.cursor = 'pointer';
372
+
373
+ const parent = el.parentElement;
374
+ if (parent) {
375
+ parent.style.pointerEvents = 'all';
376
+ }
377
+ }
378
+ });
362
379
  }
363
380
 
364
381
  const originalCallback = marker.callback;
@@ -570,19 +587,21 @@ async function calculateRoute(map) {
570
587
  return;
571
588
  }
572
589
 
573
- const waypoints = routeMarkers.map(m => `${m.position['lon']},${m.position['lat']}`).join('|');
590
+ const params = new URLSearchParams({
591
+ start: `${routeMarkers[0].position.lon},${routeMarkers[0].position.lat}`,
592
+ end: `${routeMarkers[routeMarkers.length-1].position.lon},${routeMarkers[routeMarkers.length-1].position.lat}`,
593
+ routeType: routeSettings.routeType,
594
+ apikey: siteKey
595
+ });
596
+
597
+ routeMarkers.slice(1, -1).forEach(m => {
598
+ params.append('waypoints', `${m.position.lon},${m.position.lat}`);
599
+ });
574
600
 
575
601
  try {
576
602
  const response = await fetch(
577
- `https://api.mapy.cz/v1/routing/route?` + new URLSearchParams({
578
- start: waypoints.split('|')[0],
579
- end: waypoints.split('|')[waypoints.split('|').length - 1],
580
- routeType: routeSettings.routeType,
581
- waypoints: waypoints.split('|').slice(1, -1).join('|'),
582
- apikey: siteKey,
583
- })
603
+ `https://api.mapy.cz/v1/routing/route?${params.toString()}`
584
604
  );
585
-
586
605
  const data = await response.json();
587
606
 
588
607
  if (data.geometry?.geometry?.coordinates) {