File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
samples/ui-kit-place-search-text Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -14,12 +14,18 @@ let marker = document.querySelector('gmp-advanced-marker') as any;
1414let markers = { } ;
1515let infoWindow ;
1616let center = { lat : 37.395641 , lng : - 122.077627 } ;
17+ let bounds ;
1718
1819async function initMap ( ) : Promise < void > {
19- await google . maps . importLibrary ( "places" ) ;
20- const { InfoWindow } = await google . maps . importLibrary ( "maps" ) as google . maps . MapsLibrary ;
20+ const { Map, InfoWindow } = await google . maps . importLibrary ( "maps" ) as google . maps . MapsLibrary ;
2121 const { Place } = await google . maps . importLibrary ( "places" ) as google . maps . PlacesLibrary ;
2222
23+ // Set bounds for location restriction.
24+ bounds = new google . maps . LatLngBounds (
25+ { lat : 37.37808200917261 , lng : - 122.13741583377849 } ,
26+ { lat : 37.416676154341324 , lng : - 122.02261728794109 }
27+ ) ;
28+
2329 infoWindow = new google . maps . InfoWindow ;
2430
2531 // Center the map
@@ -40,7 +46,7 @@ async function initMap(): Promise<void> {
4046async function searchByTextRequest ( textQuery ) {
4147 if ( textQuery ) {
4248 placeList . configureFromSearchByTextRequest ( {
43- locationRestriction : map . innerMap . getBounds ( ) ,
49+ locationRestriction : bounds ,
4450 includedType : "restaurant" ,
4551 textQuery : textQuery ,
4652 } ) . then ( addMarkers ) ;
You can’t perform that action at this time.
0 commit comments