dimfeld / svelte-maplibre

Svelte bindings for the MapLibre mapping library
https://svelte-maplibre.vercel.app
MIT License
283 stars 34 forks source link

Plumb sourceLayer through setFeatureState, so hovering on vector tile #72

Closed dabreegster closed 9 months ago

dabreegster commented 9 months ago

sources works.

I didn't change any example in this repo to demonstrate the problem or fix, because I don't have a pmtiles file in a stable place with feature IDs defined. My temporary diff for the pmtiles_source example used this:

+  import { hoverStateFilter } from '$lib/filters.ts';

   <VectorTileSource
-    url={'pmtiles://https://r2-public.protomaps.com/protomaps-sample-datasets/cb_2018_us_zcta510_500k.pmtiles'}
+    url={'pmtiles://https://atip.uk/layers/v1/wards.pmtiles'}
   > 
     <LineLayer
+      manageHoverState
       paint={{
         'line-opacity': 0.6,
         'line-color': 'rgb(53, 175, 109)',
-        'line-width': 2,
+        'line-width': hoverStateFilter(5, 10),
       }}
-      sourceLayer={'zcta'}
+      sourceLayer={'wards'}
     />
   </VectorTileSource>
changeset-bot[bot] commented 9 months ago

🦋 Changeset detected

Latest commit: 1aea7fa2296a3f1df1665f45a56732a484ceb4b8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | --------------- | ----- | | svelte-maplibre | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

vercel[bot] commented 9 months ago

Someone is attempting to deploy a commit to a Personal Account owned by @dimfeld on Vercel.

@dimfeld first needs to authorize it.