Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions samples/ui-kit-place-search-text/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,18 @@ let marker = document.querySelector('gmp-advanced-marker') as any;
let markers = {};
let infoWindow;
let center = { lat: 37.395641, lng: -122.077627 };
let bounds;

async function initMap(): Promise<void> {
await google.maps.importLibrary("places");
const { InfoWindow } = await google.maps.importLibrary("maps") as google.maps.MapsLibrary;
const { Map, InfoWindow } = await google.maps.importLibrary("maps") as google.maps.MapsLibrary;
const { Place } = await google.maps.importLibrary("places") as google.maps.PlacesLibrary;

// Set bounds for location restriction.
bounds = new google.maps.LatLngBounds(
{ lat: 37.37808200917261, lng: -122.13741583377849 },
{ lat: 37.416676154341324, lng: -122.02261728794109 }
);

infoWindow = new google.maps.InfoWindow;

// Center the map
Expand All @@ -40,7 +46,7 @@ async function initMap(): Promise<void> {
async function searchByTextRequest(textQuery) {
if (textQuery) {
placeList.configureFromSearchByTextRequest({
locationRestriction: map.innerMap.getBounds(),
locationRestriction: bounds,
includedType: "restaurant",
textQuery: textQuery,
}).then(addMarkers);
Expand Down