beyonk-group / svelte-mapbox

MapBox Map and Autocomplete components for Svelte (or Vanilla JS)
MIT License
343 stars 61 forks source link

Should be able to pass options through to map methods as you'd be able to do with a native mapbox implementation (e.g. fitBounds) #30

Closed sdl60660 closed 3 years ago

sdl60660 commented 3 years ago

I noticed while using the fitBounds method, that it didn't support passing through the options available to that mapbox function, such as turning off animation (which is what I was trying to do).

It seems to me that this should be as straightforward as adding an optional parameter on your Map.svelte component's methods, which is what I did locally to make it work. For example:

export function fitBounds (bbox) {
  queue.send('fitBounds', [ bbox ])
}

Just becomes...

export function fitBounds (bbox, options={}) {
    queue.send('fitBounds', [ bbox, options ])
}

I'd be happy to submit a pull request to this effect, but I'm not sure if there was a reason things were implemented this way, without options.

antony commented 3 years ago

There isn't a specific way other than I didn't need the functionality :)

Feel free to open a PR to make this change!

CraigChamberlain commented 3 years ago

I think this held me back just now. Is anyone working on a solution? I'm happy to have a go if no-one else is.

CraigChamberlain commented 3 years ago

https://github.com/beyonk-adventures/svelte-mapbox/pull/39 ??

sdl60660 commented 3 years ago

@CraigChamberlain I submitted it as a pull request.

antony commented 3 years ago

Released as v7.6.0 :) thanks!