|
87 | 87 | position: "bottomright",
|
88 | 88 | });
|
89 | 89 |
|
90 |
| -
|
91 | 90 | // Map and marker configuration
|
92 | 91 | $: defaultMarkerOptions = {
|
93 | 92 | html:
|
|
164 | 163 | $: updateLayerGroup(showLayerControlEnabled);
|
165 | 164 |
|
166 | 165 | const updateLayerGroup = (showLayerControlEnabled) => {
|
167 |
| - addLayerGroup(customIconOptions) |
168 |
| - } |
169 |
| -
|
| 166 | + addLayerGroup(customIconOptions); |
| 167 | + }; |
170 | 168 |
|
171 | 169 | const addMultipleTileLayers = (mapInstance, tileMultipleURL) => {
|
172 | 170 | mapTileLayers.clearLayers();
|
|
181 | 179 | }
|
182 | 180 | };
|
183 | 181 |
|
184 |
| -
|
185 |
| -
|
186 | 182 | const addLayerGroup = (customIconOptions) => {
|
187 | 183 | if (!mapInstance) {
|
188 | 184 | return;
|
189 | 185 | }
|
190 |
| - if(!showLayerControl){ |
| 186 | + if (!showLayerControl) { |
191 | 187 | return;
|
192 | 188 | }
|
193 | 189 |
|
|
253 | 249 | if (!mapInstance) {
|
254 | 250 | return;
|
255 | 251 | }
|
256 |
| - if (mapMasterMarkerGroup.getLayers().length) { //if custom markers |
| 252 | + if (mapMasterMarkerGroup.getLayers().length) { |
| 253 | + //if custom markers |
257 | 254 | mapInstance.setZoom(0);
|
258 | 255 | mapInstance.fitBounds(mapMasterMarkerGroup.getBounds(), {
|
259 | 256 | paddingTopLeft: [0, 24],
|
260 | 257 | });
|
261 |
| - } |
262 |
| - else if (mapMarkerGroup.getLayers().length){ //if default markers |
| 258 | + } else if (mapMarkerGroup.getLayers().length) { |
| 259 | + //if default markers |
263 | 260 | mapInstance.setZoom(0);
|
264 | 261 | mapInstance.fitBounds(mapMarkerGroup.getBounds(), {
|
265 | 262 | paddingTopLeft: [0, 24],
|
266 | 263 | });
|
267 |
| - } |
268 |
| - else { |
| 264 | + } else { |
269 | 265 | mapInstance.setView(defaultCoordinates, safeZoomLevel);
|
270 | 266 | }
|
271 | 267 | };
|
|
342 | 338 | if (!validRows?.length) {
|
343 | 339 | return;
|
344 | 340 | }
|
345 |
| - mapMasterMarkerGroup.clearLayers() |
| 341 | + mapMasterMarkerGroup.clearLayers(); |
346 | 342 | if (!initialMarkerZoomCompleted && customIconOptions) {
|
347 | 343 | addLayerGroup(customIconOptions);
|
348 | 344 | }
|
|
371 | 367 | ' ri-2x" draggable="false" style="color:' +
|
372 | 368 | colorIcon +
|
373 | 369 | '"></i></div>';
|
374 |
| - } else if (iconType == "colorCustIcon") { |
| 370 | + } |
| 371 | + else if (iconType == "divIcon") { |
| 372 | + mapMarkerOptions.icon = L.divIcon({html:lookup_element.value, className: 'dummy'}) |
| 373 | + } |
| 374 | + else if (iconType == "colorCustIcon") { |
375 | 375 | let validColor = isValidColor(lookup_element.value)
|
376 | 376 | ? lookup_element.value
|
377 | 377 | : colorIcon;
|
|
390 | 390 | iconSize: [26, 26],
|
391 | 391 | iconAnchor: [13, 26],
|
392 | 392 | popupAnchor: [0, -13],
|
393 |
| - }); |
394 |
| - } else { |
| 393 | + } |
| 394 | + |
| 395 | + ); |
| 396 | + } |
| 397 | + |
| 398 | + else { |
395 | 399 | }
|
396 | 400 | } else {
|
397 | 401 | }
|
|
453 | 457 | },
|
454 | 458 | });
|
455 | 459 |
|
456 |
| - mapInstance.addLayer(L.tileLayer(tileURL, { |
| 460 | + mapInstance.addLayer( |
| 461 | + L.tileLayer(tileURL, { |
457 | 462 | attribution: "© " + cleanAttribution,
|
458 | 463 | zoom,
|
459 |
| - })) |
| 464 | + }) |
| 465 | + ); |
460 | 466 |
|
461 | 467 | mapTileLayers.addTo(mapInstance);
|
462 | 468 |
|
463 |
| - |
464 | 469 | mapInstance.on("click", handleMapClick);
|
465 | 470 |
|
466 | 471 | // Reset view
|
|
506 | 511 | mounted = true;
|
507 | 512 | initMap(tileURL, mapAttribution, safeZoomLevel);
|
508 | 513 | });
|
509 |
| -
|
510 |
| - |
511 | 514 | </script>
|
512 | 515 |
|
513 | 516 | <div class="embedded-map-wrapper map-default" use:styleable={$component.styles}>
|
|
0 commit comments