inocan-group / vue3-google-map

A set of composable components for easy use of Google Maps in your Vue 3 projects.
https://vue3-google-map.com
MIT License
280 stars 57 forks source link

Is it possible to make sure map zooms out so all markers are visible? #57

Closed web-programmer-here closed 2 years ago

web-programmer-here commented 2 years ago

If I add the markers, they are not all visible on the map, how can I make sure the markers are all visible if that means zooming out or zooming into the map? also is there any auto center without specifying auto center if we have multiple items?

HusamElbashir commented 2 years ago

Hey @web-programmer-here there's currently no auto centering/zooming functionality. I'm afraid you'll have to do it manually. Have you seen this method in the native API? Should be useful: https://developers.google.com/maps/documentation/javascript/reference/map#Map.fitBounds

web-programmer-here commented 2 years ago

Thanks @HusamIbrahim do you have any examples? I wonder if anyone else who used this library can share their findings

HusamElbashir commented 2 years ago

Hi @web-programmer-here

I haven't used that API before but a quick search turned out this helpful result on Stack Overflow: https://stackoverflow.com/q/19304574/10341614

So here's an example of what you probably can do: https://stackblitz.com/edit/vitejs-vite-4tdpur?file=src/components/HelloWorld.vue&terminal=dev

web-programmer-here commented 2 years ago

thank you, this helped a lot