Skip to content

Commit

Permalink
Improve geocoder:
Browse files Browse the repository at this point in the history
- speed up the animation
- prefer results close to the current map center
  • Loading branch information
dabreegster committed Dec 10, 2024
1 parent 97c407b commit 1e40258
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions src/lib/common/Geocoder.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,24 @@
let mapController: MapController;
// TODO HMR is broken
onMount(() => {
mapController = createMapLibreGlMapController($map, maplibregl);
let marker = true;
let showResultMarkers = true;
let flyToOptions = {
duration: 1000,
};
let fitBoundsOptions = {
duration: 1000,
};
mapController = createMapLibreGlMapController(
$map,
maplibregl,
marker,
showResultMarkers,
flyToOptions,
fitBoundsOptions,
);
});
// TODO Show markers
// TODO Set the flyTo duration
</script>

{#if mapController}
Expand All @@ -27,6 +38,11 @@
{mapController}
apiKey={import.meta.env.VITE_MAPTILER_API_KEY}
country="gb"
proximity={[
{
type: "map-center",
},
]}
/>
</div>
{/if}
Expand Down

0 comments on commit 1e40258

Please sign in to comment.