dimfeld / svelte-maplibre

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

Setting bounds may not work right #23

Closed dimfeld closed 1 year ago

dimfeld commented 1 year ago

Need to see if it's on initial set or on subsequent set but something seemed off a couple days ago.

Qwennnnnnn commented 1 year ago

Hello, as you expected, I have an issue on the initial bounds option. Issue: "bounds" options of component does not set the initial bounds of the map as expected How to reproduce: Instantiate a component with "bounds" argument specified to a LngLatBoundsLike value. After loading time, the map is fully unzoomed. What to expect: Setting the "bounds" option should fit to it after load. It should overrides "zoom"/"center" constructor options if they exist.

dabreegster commented 1 year ago

Seeing the same problem. https://github.com/dabreegster/svelte-maplibre/commit/43466bb4220a6ef56bc4031b0ecd2e5dc47b3f27 is a very weird workaround. The caller explicitly setting center={undefined} doesn't seem to work. null does, but then it doesn't type-check. It might make more sense to remove the default values for center and zoom instead.

I'll try a few things out, clean it up, and send a PR