-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Labels
Description
Bug Report
Plugin(s)
7.0.3
Capacitor Version

Platform(s)
Web
Current Behavior
I wanted to get the current lat and lng on click a marker cluster and do zoom.
The function setOnClusterClickListener returna ClusterClickCallbackData and indicates that it latitude is a number
setOnClusterClickListener(callback?: MapListenerCallback<ClusterClickCallbackData>): Promise<void>;
export interface ClusterClickCallbackData {
mapId: string;
latitude: number;
longitude: number;
size: number;
items: MarkerCallbackData[];
}
On Android this works but on web latitude and longitude is returning a function. And if i call a function on Android brakes...

Expected Behavior
Regardless of the platform, the functions work the same.
Code Reproduction
await this.googleMap.setOnClusterClickListener(async (event) => {
console.log(event)
});
Other Technical Details
Additional Context
What i have done to solve this:
await this.googleMap.setOnClusterClickListener(async (event: any) => {
let lat = event.latitude;
let lng = event.longitude;
if (typeof lat === 'function') {
lat = lat();
}
if (typeof lng === 'function') {
lng = lng();
}
if (this.currentZoom < 21) {
await this.googleMap.setCamera({
coordinate: { lat: lat, lng: lng },
zoom: ++this.currentZoom,
animate: true,
});
}
});
Note: in case anyone is wondering where it comes from this.currentZoom.
await this.googleMap.setOnCameraIdleListener((event) => {
this.currentZoom = event.zoom;
});