mapsplugin / cordova-plugin-googlemaps

Google Maps plugin for Cordova
Apache License 2.0
1.66k stars 918 forks source link

Map not catching gesture when orientation is set to follow device orientation #2866

Open FrancescoCerio opened 3 years ago

FrancescoCerio commented 3 years ago

I'm submitting a ... (check one with "x")

OS: (check one with "x")

cordova information: (run $> cordova plugin list)

com.googlemaps.ios 3.9.0 "Google Maps SDK for iOS"
cordova-androidx-build 1.0.4 "cordova-androidx-build"
cordova-plugin-add-swift-support 2.0.2 "AddSwiftSupport"
cordova-plugin-androidx-adapter 1.1.3 "cordova-plugin-androidx-adapter"
cordova-plugin-androidx 3.0.0 "cordova-plugin-androidx"
cordova-plugin-background-geolocation 3.1.0 "CDVBackgroundGeolocation"
cordova-plugin-device-orientation 2.0.1 "Device Orientation"
cordova-plugin-device 2.0.3 "Device"
cordova-plugin-foreground-service 1.1.3 "Cordova Foreground Service"
cordova-plugin-geolocation 4.1.0 "Geolocation"
cordova-plugin-googlemaps 2.8.0-20200709-2008 "cordova-plugin-googlemaps"
cordova-plugin-gyroscope 0.1.4 "Device Gyroscope"
cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 5.0.0 "cordova-plugin-ionic-webview"
cordova-plugin-mqtt 0.3.8 "CordovaMqTTPlugin"
cordova-plugin-request-location-accuracy 2.3.0 "Request Location Accuracy"
cordova-plugin-splashscreen 5.0.4 "Splashscreen"
cordova-plugin-statusbar 2.4.3 "StatusBar"
cordova-plugin-vibration 3.1.1 "Vibration"
cordova-plugin-whitelist 1.3.4 "Whitelist"
cordova-sqlite-storage 5.1.0 "Cordova sqlite storage plugin - cordova-sqlite-storage plugin version"
cordova.plugins.diagnostic 6.0.3 "Diagnostic"
phonegap-plugin-barcodescanner 8.1.0 "BarcodeScanner"
sentry-cordova 0.17.0 "Sentry"

If you use @ionic-native/google-maps, please tell the package.json (only @ionic-native/core and @ionic-native/google-maps are fine mostly)

@ionic-native/core :  "^5.30.0"
@ionic-native/google-maps : "^5.27.0-beta-20200630"

Current behavior: On iOS devices, gesture events are not captured when the map rotation follows the device orientation. The bug occurs when the map is set by the user in manual rotation mode. This setting allows the map to rotate automatically based on the orientation of the device. Once this mode is set, the map doesn't seem to capture any gesture event (zoom, drag, etc..) yet they are all set to true in the GoogleMapGestureOptions object.

Expected behavior: In theory this should not happen and the user should be able to move and zoom on the map without any problem. In fact on Android devices the bug does not occur and everything proceeds in the right way.

[Android] $> adb shell screenrecord /sdcard/capture.mp4 $> adb pull /sdcard/capture.mp4 ./ [iOS] Use QuickTimer player on Mac --->

Related code, data or error log (please format your code or data):

Short video explaining the issue
https://user-images.githubusercontent.com/7487808/116254063-51c5e980-a771-11eb-9140-b5319d7056cc.mov

Support this plugin activity

I appreicate if you give me a beer :beer: from here

wf9a5m75 commented 3 years ago

Please share your project files on GitHub (Do not past your code, or zip file here). If you can't share your code, please create another project that reproduce your issue.

I think you're misconfigured.

FrancescoCerio commented 3 years ago

Thank you for your quick reply! I'm cloning the project in order to reproduce the problem, in the meantime I would like to show you briefly how I implemented the map rotation so that it follows the device rotation.

I have set a timer that every 10 seconds calls the setCameraBearing() function of GoogleMap passing as parameter the number relative to the orientation of the device at that time.

Reading from the documentation this is the only way I found to be able to implement this feature. On Android it works without any problem, iOS on the other hand crashes and only auto rotation works, as if it takes precedence over any other user gesture.

Is this implementation correct or is there a simpler and more effective way?

wf9a5m75 commented 3 years ago

This plugin simply passes the parameters to the Google Maps SDKs. Inside the SDKs are in charged by Google, not me.

The code of this plugin on Android and iOS are almost the same as much as possible.

So, please use as is.