|
198 | 198 | areaToColorLookup?: object;
|
199 | 199 | } = $props();
|
200 | 200 |
|
201 |
| - $inspect(clickedArea); |
202 |
| -
|
203 | 201 | // ISO-3166/ONS-style prefixes for area codes
|
204 | 202 | const areaCodePrefixes: Record<string, string[]> = {
|
205 | 203 | england: ["E"], // all area codes starting with E
|
|
409 | 407 | );
|
410 | 408 |
|
411 | 409 | let hoveredArea = $state();
|
| 410 | + let hoveredAreaArray = $derived(hoveredArea ? [hoveredArea] : []); |
412 | 411 | let hoveredAreaData = $state();
|
413 | 412 | let currentMousePosition = $state();
|
414 | 413 |
|
| 414 | + $inspect(clickedArea, hoveredAreaArray); |
| 415 | +
|
415 | 416 | function convertToLngLatBounds(coords: LngLatBoundsLike): LngLatBoundsLike {
|
416 | 417 | const bounds = new LngLatBounds(coords[0], coords[0]);
|
417 | 418 |
|
|
587 | 588 | );
|
588 | 589 | </script>
|
589 | 590 |
|
590 |
| -<div style="position: relative; height: {mapHeight}px; width: 100%;"> |
| 591 | +<div style="height: {mapHeight}; width: 100%"> |
591 | 592 | <MapLibre
|
592 | 593 | bind:map
|
593 | 594 | bind:loaded
|
|
758 | 759 | sourceLayer={vectorLayerName}
|
759 | 760 | manageHoverState={interactive}
|
760 | 761 | />
|
| 762 | + {#if hoveredArea} |
| 763 | + <LineLayer |
| 764 | + layout={{ "line-cap": "round", "line-join": "round" }} |
| 765 | + paint={{ "line-width": 5, "line-color": "orange" }} |
| 766 | + beforeLayerType="symbol" |
| 767 | + sourceLayer={vectorLayerName} |
| 768 | + manageHoverState={interactive} |
| 769 | + filter={hoveredArea |
| 770 | + ? ["==", ["get", promoteProperty], hoveredArea] |
| 771 | + : undefined} |
| 772 | + /> |
| 773 | + {/if} |
| 774 | + <!-- <LineLayer |
| 775 | + layout={{ "line-cap": "round", "line-join": "round" }} |
| 776 | + paint={paintObject} |
| 777 | + beforeLayerType="symbol" |
| 778 | + sourceLayer={vectorLayerName} |
| 779 | + manageHoverState={interactive} |
| 780 | + /> --> |
| 781 | + <!-- <LineLayer |
| 782 | + layout={{ "line-cap": "round", "line-join": "round" }} |
| 783 | + paint={paintObject} |
| 784 | + beforeLayerType="symbol" |
| 785 | + sourceLayer={vectorLayerName} |
| 786 | + manageHoverState={interactive} |
| 787 | + filter={["==", ["get", "id"], clickedArea]} |
| 788 | + /> --> |
| 789 | + <!-- <LineLayer |
| 790 | + layout={{ "line-cap": "round", "line-join": "round" }} |
| 791 | + paint={{ "line-color": "red", "line-width": 10 }} |
| 792 | + beforeLayerType="symbol" |
| 793 | + sourceLayer={vectorLayerName} |
| 794 | + manageHoverState={interactive} |
| 795 | + filter={["==", ["get", "id"], hoveredAreaArray]} |
| 796 | + /> --> |
761 | 797 | {/if}
|
762 | 798 | </VectorTileSource>
|
763 | 799 | {:else}
|
|
0 commit comments