Closed sinisarudan closed 2 years ago
Hi @sinisarudan
It doesn't look like the bounds_changed
listener callback can receive any arguments:
https://developers.google.com/maps/documentation/javascript/reference/map#Map-Events
As for getBounds
it should be available as mapRef.value.map.getBounds
Thanks @HusamIbrahim for the quick reply.
You're right, after checking official docs, I do see that bounds_changed
does not receive any argument.
Regarding mapRef.value.map.getBounds
: maybe I've mistreated this event to cause me seeing getBounds
not working. After cleaning the code, eliminating the event part, etc, this DOES work:
const mapRef = ref(null);
let gMap: google.maps.Map;
let bounds: google.maps.LatLngBounds | undefined;
const boundsChanged = () => {
if(!gMap) {
gMap = (mapRef.value as any).map;
console.log("[boundsChanged] gMap", gMap);
}
bounds = gMap.getBounds();
console.log(`[boundsChanged] bounds : ${bounds}`);
};
So, I'm closing the issue. Thanks again and sorry for bothering!
Here are excerpts from the code: