mapsplugin / cordova-plugin-googlemaps

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

[Android] GoogleMaps.create() does not respect the Camera.target options #2873

Closed ebhsgit closed 3 years ago

ebhsgit commented 3 years ago

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

OS: (check one with "x")

cordova information: (run $> cordova plugin list)

cordova-plugin-device 2.0.3 "Device"
cordova-plugin-googlemaps 2.7.1 "cordova-plugin-googlemaps"
cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 4.1.1 "cordova-plugin-ionic-webview"
cordova-plugin-splashscreen 5.0.3 "Splashscreen"
cordova-plugin-statusbar 2.4.3 "StatusBar"
cordova-plugin-whitelist 1.3.4 "Whitelist"

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 :  4.20.0
@ionic-native/google-maps : 4.21.0

Current behavior:

When you pass an options object with camera.target set. Calling GoogleMaps.create("divId", options), will show the map. But retrieving the camera position when the map is ready, shows that the CameraPosition.Target is not exactly the value that is passed via options

Expected behavior:

The getCameraPosition().target should have exactly the same value as options.camera.target

Screen capture or video record:

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

https://github.com/ebhsgit/gmap-test/tree/bug-incorrect_cameraTarget

Running the code will result in the following lines in Console

com.ionicgmapstest I/chromium: [INFO:CONSOLE(110)] "-----Map.TARGET mapOptions [lat: 65.9667] [lng: -18.5333]", source: http://localhost/build/main.js (110)
com.ionicgmapstest I/chromium: [INFO:CONSOLE(115)] "-----Map.TARGET mapReady [lat: 65.96669994339966] [lng: -18.53329986333847]", source: http://localhost/build/main.js (115)

Support this plugin activity

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

wf9a5m75 commented 3 years ago

The maps sdk adjusts the camera position to contain the given bounds. Not fit exactly to the given bounds

ebhsgit commented 3 years ago

I see.

Thanks for the information