Skip to content

Commit 812c9f0

Browse files
committed
fix(maps): udpate code implementation for new version
1 parent cbe6527 commit 812c9f0

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/providers/native-google-maps/native-google-maps.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { ElementRef, Injectable } from '@angular/core';
22
import {
33
CameraPosition,
44
GoogleMap,
5+
GoogleMapOptions,
56
GoogleMaps,
67
GoogleMapsAnimation,
78
GoogleMapsEvent,
@@ -23,17 +24,16 @@ export class NativeGoogleMapsProvider {
2324

2425
// Note: Call this method on ngAfterViewInit
2526
create(element: ElementRef) {
26-
27-
const cameraPosition: CameraPosition = {
28-
zoom : 18,
29-
tilt : 10
30-
};
31-
32-
const options = {
27+
const mapOptions: GoogleMapOptions = {
28+
camera: {
29+
target: {
30+
lat: 43.0741904,
31+
lng: -89.3809802
32+
},
33+
zoom: 18,
34+
tilt: 10
35+
},
3336
mapType: GoogleMapsMapTypeId.NORMAL,
34-
styles: [],
35-
camera: cameraPosition,
36-
backgroundColor: 'white',
3737
controls: {
3838
compass: true,
3939
myLocationButton: true,
@@ -46,10 +46,10 @@ export class NativeGoogleMapsProvider {
4646
rotate: true,
4747
zoom: true
4848
},
49-
preferences: null,
49+
preferences: null
5050
};
5151

52-
this.map = this.googleMaps.create(element.nativeElement, options);
52+
this.map = this.googleMaps.create(element.nativeElement, mapOptions);
5353
return this.map.one(GoogleMapsEvent.MAP_READY);
5454
}
5555

@@ -73,12 +73,12 @@ export class NativeGoogleMapsProvider {
7373
}
7474

7575
centerToPosition(latLng: any, zoom?: number, tilt?: number) {
76-
const cameraPosition: CameraPosition = {
76+
const cameraPosition = {
7777
target: latLng,
7878
zoom : zoom || 18,
7979
tilt : tilt || 10
8080
};
81-
return this.map.moveCamera(cameraPosition);
81+
return this.map.animateCamera(cameraPosition);
8282
}
8383

8484
addMarker(position, title: string, infoClickCallback, animated = true) {

0 commit comments

Comments
 (0)