-
The original JS plugin accepts custom properties when you create overlays. For example:
map.addMarker({ position: {lat: ..., lng: ...}, customProperty1: "customValue1", customProperty2: "customValue2" }, function(marker) { var value = marker.get("customProperty1"); });
As of @ionic-native/google-maps v4.4.0, you can write this code as well.
map.addMarker({ position: {lat: ..., lng: ...}, customProperty1: "customValue1", customProperty2: "customValue2" }).then((marker: Marer) => { let value = marker.get("customProperty1"); });
-
The
GoogleMaps
,Environment
,Geocoder
,Spherical
andPoly(new)
classes are static class. However until @ionic-native/google-maps v4.3.3, these classes were defined as non static classes.The problem is you can create multiple instance from their. For example, you can do like this code.
let env1: Environment = new Environment(); let env2: Environment = new Environment(); env1.setBackgroundColor('red'); env2.setBackgroundColor('blue');
As of @ionic-native/google-maps v4.4.0, you need to write like this:
Environment.setBackgroundColor('red');
As the same way, the way of creating a map is changed.
before
export class HomePage { map: GoogleMap; constructor( public navCtrl: NavController, public toastCtrl: ToastController, private googleMaps: GoogleMaps) { } ionViewDidLoad() { this.loadMap(); } loadMap() { this.map = this.googleMaps.create('map_canvas'); this.map.one(GoogleMapsEvent.MAP_READY).then(() => { ... }); } }
after
export class HomePage { map: GoogleMap; constructor( public navCtrl: NavController, public toastCtrl: ToastController) { // <-- no longer need to define in constructor } ionViewDidLoad() { this.loadMap(); } loadMap() { this.map = GoogleMaps.create('map_canvas'); // <-- changed this.map.one(GoogleMapsEvent.MAP_READY).then(() => { ... }); } }
-
Add: poly.containsLocation() and poly.isLocationOnEdge() methods.