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;
14
14
let markers = { } ;
15
15
let infoWindow ;
16
16
let center = { lat : 37.395641 , lng : - 122.077627 } ;
17
+ let bounds ;
17
18
18
19
async 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 ;
21
21
const { Place } = await google . maps . importLibrary ( "places" ) as google . maps . PlacesLibrary ;
22
22
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
+
23
29
infoWindow = new google . maps . InfoWindow ;
24
30
25
31
// Center the map
@@ -40,7 +46,7 @@ async function initMap(): Promise<void> {
40
46
async function searchByTextRequest ( textQuery ) {
41
47
if ( textQuery ) {
42
48
placeList . configureFromSearchByTextRequest ( {
43
- locationRestriction : map . innerMap . getBounds ( ) ,
49
+ locationRestriction : bounds ,
44
50
includedType : "restaurant" ,
45
51
textQuery : textQuery ,
46
52
} ) . then ( addMarkers ) ;
You can’t perform that action at this time.
0 commit comments