mapsplugin / cordova-plugin-googlemaps

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

Viewport boundaries behaviour when coordinates difference greater than 180 #2885

Open qrollin opened 3 years ago

qrollin 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-plugin-actionsheet 2.3.3 "ActionSheet"
cordova-plugin-androidx 1.0.2 "cordova-plugin-androidx"
cordova-plugin-androidx-adapter 1.1.0 "cordova-plugin-androidx-adapter"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-browsersync-gen2 1.2.0 "cordova-plugin-browsersync-gen2"
cordova-plugin-camera 4.1.0 "Camera"
cordova-plugin-device 2.0.3 "Device"
cordova-plugin-dialogs 2.0.1 "Notification"
cordova-plugin-exit 1.0.3 "Exit"
cordova-plugin-fcm-with-dependecy-updated 6.0.1 "Cordova FCM Push Plugin"
cordova-plugin-geolocation 4.1.0 "Geolocation"
cordova-plugin-googlemaps 2.7.1 "cordova-plugin-googlemaps"
cordova-plugin-inappbrowser 4.1.0 "InAppBrowser"
cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 4.2.1 "cordova-plugin-ionic-webview"
cordova-plugin-is-debug 1.0.0 "IsDebug"
cordova-plugin-localization-strings 3.2.1 "Localization"
cordova-plugin-network-information 2.0.2 "Network Information"
cordova-plugin-splashscreen 5.0.3 "Splashscreen"
cordova-plugin-whitelist 1.3.4 "Whitelist"
cordova-sqlite-storage 6.0.0 "Cordova SQLite storage plugin - cordova-sqlite-storage plugin version"
ionic-plugin-deeplinks 1.0.20 "Ionic Deeplink Plugin"
uk.co.workingedge.phonegap.plugin.launchnavigator 5.0.4 "Launch Navigator"

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.31.1
@ionic-native/google-maps : 5.5.0

Current behavior: When using options.preferences.gestureBounds, if the difference between the most extreme coordinates of the given points is greater than 180, the viewport centers on the shortest path between these extremes. In addition to that, points added to the options.preferences.gestureBounds will be ignored if they are not an extreme (cf. extend method of LatLngBounds object here)

Example :

const max = new LatLng(-10, -82);
const max = new LatLng(70, 100);
const middle = new LatLng(30, 9);
return GoogleMaps.create(element, {
    preferences: {
        gestureBounds: [max, min, middle]
    }
});

Expected behavior: There should be a way to bypass the "normalization" of these extremes and define each corner of the viewport boundary specifically. Or is there another way to limit the viewport scroll by defining points that should always be visible (like defining a center) ?

Example :

const max = new LatLng(-10, -82);
const max = new LatLng(70, 100);
return GoogleMaps.create(element, {
    preferences: {
        gestureBounds: {southwest: min, northeast: max}
    }
});