doublesecretagency / craft-googlemaps

Google Maps plugin for Craft CMS - Maps in minutes. Powered by the Google Maps API.
https://plugins.doublesecretagency.com/google-maps/
Other
10 stars 8 forks source link

Add JS methods to get current `center` and `zoom` values #35

Closed lindseydiloreto closed 2 years ago

lindseydiloreto commented 2 years ago

If a front-end map has been moved or zoomed by the user, we may need to know the current center coordinates and zoom level. It's already possible to get this information, but it's a little ugly...

let map = googleMaps.getMap('MAPID');
let center = map._map.center;
let zoom   = map._map.zoom;

We should add a couple of methods to make this a little more intuitive...

let map = googleMaps.getMap('MAPID');
let center = map.getCenter();
let zoom   = map.getZoom();
lindseydiloreto commented 2 years ago

Similarly, we should elevate getBounds...

// Wrapper for `map._map.getBounds()`
let bounds = map.getBounds();
lindseydiloreto commented 2 years ago

This is done, and will be available in v4.1.4