MAP_CLICK event causes extreme zoom to happen on the map
I'm submitting a ... (check one with "x")
- [ ] question
- [x] any problem or bug report
- [ ] feature request
If you choose 'problem or bug report', please select OS: (check one with "x")
- [x] Android
- [x] iOS
cordova information: (run $> cordova plugin list)
com.cordova.plugin.SamsungPassPlugin 1.0.0 "SamsungPassPlugin"
com.googlemaps.ios 2.6.0 "Google Maps SDK for iOS"
cordova-fabric-plugin 1.1.9 "cordova-fabric-plugin"
cordova-open-native-settings 1.4.1 "Native settings"
cordova-plugin-android-fingerprint-auth 0.3.1 "FingerprintAuth"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-appminimize 1.0 "AppMinimize"
cordova-plugin-camera 2.3.1 "Camera"
cordova-plugin-compat 1.2.0 "Compat"
cordova-plugin-crosswalk-webview 2.3.0 "Crosswalk WebView Engine"
cordova-plugin-device 1.1.6 "Device"
cordova-plugin-firebase 0.1.25 "Google Firebase Plugin"
cordova-plugin-geolocation 2.4.3 "Geolocation"
cordova-plugin-googlemaps 2.2.7 "cordova-plugin-googlemaps"
cordova-plugin-inappbrowser 1.7.1 "InAppBrowser"
cordova-plugin-ionic-webview 1.1.17dev "cordova-plugin-ionic-webview"
cordova-plugin-network-information 1.3.3 "Network Information"
cordova-plugin-safe-drive 0.0.1 "SafeDrive"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-statusbar 2.2.3 "StatusBar"
cordova-plugin-touch-id 3.2.0 "Touch ID"
cordova-plugin-whitelist 1.3.2 "Whitelist"
cordova-plugin-x-toast 2.5.2 "Toast"
cordova.plugins.diagnostic 3.7.1 "Diagnostic"
ionic-plugin-keyboard 2.2.1 "Keyboard"
If you use @ionic-native/google-maps, please tell the package.json (only @ionic-native/core and @ionic-native/google-maps are fine mostly)
4.4.2
Current behavior:
When MAP_CLICK event happens it causes extreme zoom to happen on the map
Expected behavior:
Expects MAP_CLICK event to just return the selected LatLng.
Screen capture or video record:
Related code, data or error log (please format your code or data):
map.on(GoogleMapsEvent.MAP_CLICK).subscribe((position: LatLng) => {
this.markers.map((marker) => {
marker.remove();
});
this.markers.length = 0;
map.addMarker({
position: new LatLng(position.lat, position.lng) //Using position directly crashes
}).then((marker: Marker) => {
this.markers.push(marker);
this.map.animateCamera({target: position, zoom: this.defaultZoom, duration: 10});
}).catch((error) => {
console.error(error);
});
});
Please share the project files that reproduce your issue 100% onto GitHub.
By the way, your code is wrong.
this.map.on(GoogleMapsEvent.MAP_CLICK).subscribe((position: LatLng) => {
is wrong code.
this.map.on(GoogleMapsEvent.MAP_CLICK).subscribe((params: any[]) => {
let position: LatLng = params[0];
is correct code.
This is the code and screen record.
this.map.one(GoogleMapsEvent.MAP_READY).then(() => {
this.mapReady = true;
this.map.on(GoogleMapsEvent.MAP_CLICK).subscribe((params: any[]) => {
let position: LatLng = params[0];
this.map.addMarker({
position: position
}).then((marker: Marker) => {
this.map.animateCamera({target: position, zoom: 18, duration: 500});
}).catch((error) => {
console.error(error);
});
});
});
Android 5.1 / Nexus 7(2012)

ping
ping
Since there is no response and this is not plugin's bug, I close this thread.