Skip to content

Commit

Permalink
Fix pollution flickering when opacity changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dabreegster committed Jun 6, 2024
1 parent 3f10f8d commit 4746cb8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lib/browse/layers/areas/Pollution.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
PM10Roads_viridis: ["22", "Data for 2022"],
}[$state.pollutant];
// Changes to opacity shouldn't re-render the tile URL. Use this indirection
// (thanks to https://thoughtspile.github.io/2023/04/22/svelte-state/)
$: url = tilesUrl($state.pollutant);
function wmsUrl(): string {
return `https://ukair.maps.rcdo.co.uk/ukairserver/services/aq_amb_2022/${$state.pollutant}/MapServer/WMSServer`;
}
Expand Down Expand Up @@ -122,7 +126,7 @@
/>
{/if}

<RasterTileSource tiles={[tilesUrl($state.pollutant)]} tileSize={256}>
<RasterTileSource tiles={[url]} tileSize={256}>
<RasterLayer
{...layerId("pollution")}
paint={{
Expand Down

0 comments on commit 4746cb8

Please sign in to comment.