File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import MapOptions = google.maps.MapOptions
22import Map = google . maps . Map
33
44import './location-picker.css'
5+ import LatLng = google . maps . LatLng
56
67export default class LocationPicker {
78 element : HTMLElement | null
@@ -49,6 +50,15 @@ export default class LocationPicker {
4950 }
5051 }
5152
53+ getMarkerPosition ( ) {
54+ const latLng = this . map . getCenter ( )
55+ return { lat : latLng . lat ( ) , lng : latLng . lng ( ) }
56+ }
57+
58+ setLocation ( lat : number , lng : number ) {
59+ this . map . setCenter ( new google . maps . LatLng ( lat , lng ) )
60+ }
61+
5262 setCurrentPosition ( ) {
5363 if ( navigator . geolocation ) {
5464 navigator . geolocation . getCurrentPosition (
@@ -67,11 +77,6 @@ export default class LocationPicker {
6777 console . log ( 'Your browser does not support Geolocation.' )
6878 }
6979 }
70-
71- getMarkerPosition ( ) {
72- const latLng = this . map . getCenter ( )
73- return { lat : latLng . lat ( ) , lng : latLng . lng ( ) }
74- }
7580}
7681
7782export interface LocationPickerOptions {
You can’t perform that action at this time.
0 commit comments