Google maps ionic native


#1

Someone knows a way to detect if the zoom changed and bounds change.I read that there is a addListener function but i dont know the syntaxis

i know that the no native way is like this:

> google.maps.event.addListener(map, "bounds_changed", function () {

> })

I would like to know if someone knows the native way. Thanks


#2

googleMaps.addEventListener wants a string, event name, as a parameter and returns an Observable:


#3
map.addEventListener("bounds_changed").subscribe((bounds) => {
    console.log(1);
})

I moved the map and never triggers de event, the one is never logged

Thats the way to handle the returned observable right?


#4

If i make a console.log of map i get :


GoogleMap {_objectInstance: App}

addEventListener:function (eventName, callback)

So it has the addEventListener method inside i dont know why doenst do anything


#5

With this code i can get the zoom and lat and lng, but i need latlngbounds someone knows a way to get the bounds:
this.map.on(GoogleMapsEvent.CAMERA_CHANGE).subscribe(data => {console.log(data);});

CameraPosition {zoom: 14.15488052368164, tilt: 0, target: Object, bearing: 0, hashCode: -1384107267…}

The code of camera position is:

export interface CameraPosition {
  target?: LatLng | LatLngBounds | LatLng[];
  zoom?: number;
  tilt?: number;
  bearing?: number;
}