dimfeld / svelte-maplibre

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

Style doesn't reflect the changes if style changed #51

Closed SiddHyper closed 1 year ago

SiddHyper commented 1 year ago

Map.svelte

<script lang="ts">
  import { MapLibre, ScaleControl } from 'svelte-maplibre';
  import LayerSelector from './components/layer-selector.svelte';
  import { Layers } from './store/layer.store';

  let styleURL: string;

  Layers.subscribe((value) => {
    styleURL = value.styleURL;
  });
</script>

<div>{styleURL}</div>

<MapLibre style={styleURL} class="relative h-screen w-full" attributionControl={false}>
  <LayerSelector />
  <ScaleControl />
</MapLibre>

layer.store.ts

import { writable } from 'svelte/store';
import { MAP_LAYERS } from '../constants';

export const Layers = writable(MAP_LAYERS[0]);

the url in web page as string is changing but the map doesn't change with that

dimfeld commented 1 year ago

Released in v0.3.5