dimfeld / svelte-maplibre

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

Updating `Marker` `class` breaks it's position and scaling #53

Closed FluffyDiscord closed 10 months ago

FluffyDiscord commented 10 months ago

I am experiencing weird behavior where updating markers class makes it jump to the left for some unknown reason and then when zooming or moving it's position is "scaling" instead of moving along the map. For simplicity sake I am updating brightness and making it black in this example video.

https://github.com/dimfeld/svelte-maplibre/assets/10332247/f3a8ce47-08ce-4081-b37f-2fe30dc7eed4

<Marker class="relative group group-hover:z-10 hover:z-10 transition-colors {isSelected ? 'brightness-0' :''}"
                    lngLat={marker.position}
                    on:click={() => handleSelectMarker(marker)}
            >
</Marker>
dimfeld commented 10 months ago

It's likely overwriting some classes that MapLibre is adding. Probably have to change it to split out the class string manually, and then add/remove those specific classes as the class string changes. I don't think this will be too bad to do.

dimfeld commented 10 months ago

Released in v0.3.5