Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion dist/samples/ui-kit-place-search/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
<script type="module" src="./index.js"></script>
</head>
<body>
<h1>Place List Nearby Search with Google Maps</h1>
<!--[START maps_ui_kit_place_search_map] -->
<gmp-map center="-37.813,144.963" zoom="10" map-id="DEMO_MAP_ID">
<div class="overlay" slot="control-inline-start-block-start">
Expand Down
21 changes: 11 additions & 10 deletions dist/samples/ui-kit-place-search/app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,24 @@ const placeDetails = document.querySelector("gmp-place-details") as any;
let marker = document.querySelector('gmp-advanced-marker') as any;
/* [END maps_ui_kit_place_search_query_selectors] */
let markers = {};
let infowindow;
let infoWindow;
let mapCenter;

async function initMap(): Promise<void> {
await google.maps.importLibrary("places");
const { InfoWindow } = await google.maps.importLibrary("maps") as google.maps.MapsLibrary;
const { spherical } = await google.maps.importLibrary("geometry") as google.maps.GeometryLibrary;

infowindow = new google.maps.InfoWindow;
infoWindow = new google.maps.InfoWindow;

function getContainingCircle(bounds) {
const diameter = spherical.computeDistanceBetween(
bounds.getNorthEast(),
bounds.getSouthWest()
);
return { center: bounds.getCenter(), radius: diameter / 2 };
const calculatedRadius = diameter / 2;
const cappedRadius = Math.min(calculatedRadius, 50000); // Cap the radius to avoid an error.
return { center: bounds.getCenter(), radius: cappedRadius };
}

findCurrentLocation();
Expand All @@ -41,7 +43,6 @@ async function initMap(): Promise<void> {
typeSelect.addEventListener("change", (event) => {
// First remove all existing markers.
for(marker in markers){
console.log(marker);
markers[marker].map = null;
}
markers = {};
Expand All @@ -53,7 +54,7 @@ async function initMap(): Promise<void> {
),
includedPrimaryTypes: [typeSelect.value],
}).then(addMarkers);

// Handle user selection in Place Details.
placeList.addEventListener("gmp-placeselect", ({ place }) => {
markers[place.id].click();
});
Expand All @@ -79,20 +80,20 @@ async function addMarkers(){
bounds.extend(place.location);

marker.addListener('gmp-click',(event) => {
if(infowindow.isOpen){
infowindow.close();
if(infoWindow.isOpen){
infoWindow.close();
}
placeDetails.configureFromPlace(place);
placeDetails.style.width = "350px";
infowindow.setOptions({
infoWindow.setOptions({
content: placeDetails
});
infowindow.open({
infoWindow.open({
anchor: marker,
map: map.innerMap
});
placeDetails.addEventListener('gmp-load',() => {
map.innerMap.fitBounds(place.viewport, {top: placeDetails.offsetHeight || 206, left: 200});
map.innerMap.fitBounds(place.viewport, { top: 400, left: 200 });
});

});
Expand Down
5 changes: 4 additions & 1 deletion dist/samples/ui-kit-place-search/app/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ html,
gmp-map {
box-sizing: border-box;
padding: 0 20px 20px;
height: 600px;
}

.overlay {
position: relative;
top: 40px;
margin: 20px;
width: 400px;
}
Expand Down Expand Up @@ -55,7 +58,7 @@ html,
}

.list-container {
height: 600px;
height: 400px;
overflow: auto;
border-radius: 10px;
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions dist/samples/ui-kit-place-search/dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@
<head>
<title>Place List Nearby Search with Google Maps</title>
<meta charset="utf-8">
<script type="module" crossorigin src="./assets/index-BmKxyk8Z.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-BaQItlwa.css">
<script type="module" crossorigin src="./assets/index-4cFOkOyn.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-lUDwP8WY.css">
</head>
<body>
<h1>Place List Nearby Search with Google Maps</h1>
<!--[START maps_ui_kit_place_search_map] -->
<gmp-map center="-37.813,144.963" zoom="10" map-id="DEMO_MAP_ID">
<div class="overlay" slot="control-inline-start-block-start">
Expand Down
1 change: 0 additions & 1 deletion dist/samples/ui-kit-place-search/docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
<script type="module" src="./index.js"></script>
</head>
<body>
<h1>Place List Nearby Search with Google Maps</h1>
<!--[START maps_ui_kit_place_search_map] -->
<gmp-map center="-37.813,144.963" zoom="10" map-id="DEMO_MAP_ID">
<div class="overlay" slot="control-inline-start-block-start">
Expand Down
20 changes: 11 additions & 9 deletions dist/samples/ui-kit-place-search/docs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@ const placeDetails = document.querySelector("gmp-place-details");
let marker = document.querySelector('gmp-advanced-marker');
/* [END maps_ui_kit_place_search_query_selectors] */
let markers = {};
let infowindow;
let infoWindow;
let mapCenter;
async function initMap() {
await google.maps.importLibrary("places");
const { InfoWindow } = await google.maps.importLibrary("maps");
const { spherical } = await google.maps.importLibrary("geometry");
infowindow = new google.maps.InfoWindow;
infoWindow = new google.maps.InfoWindow;
function getContainingCircle(bounds) {
const diameter = spherical.computeDistanceBetween(bounds.getNorthEast(), bounds.getSouthWest());
return { center: bounds.getCenter(), radius: diameter / 2 };
const calculatedRadius = diameter / 2;
const cappedRadius = Math.min(calculatedRadius, 50000); // Cap the radius to avoid an error.
return { center: bounds.getCenter(), radius: cappedRadius };
}
findCurrentLocation();
map.innerMap.setOptions({
Expand All @@ -32,7 +34,6 @@ async function initMap() {
typeSelect.addEventListener("change", (event) => {
// First remove all existing markers.
for (marker in markers) {
console.log(marker);
markers[marker].map = null;
}
markers = {};
Expand All @@ -41,6 +42,7 @@ async function initMap() {
locationRestriction: getContainingCircle(map.innerMap.getBounds()),
includedPrimaryTypes: [typeSelect.value],
}).then(addMarkers);
// Handle user selection in Place Details.
placeList.addEventListener("gmp-placeselect", ({ place }) => {
markers[place.id].click();
});
Expand All @@ -61,20 +63,20 @@ async function addMarkers() {
markers[place.id] = marker;
bounds.extend(place.location);
marker.addListener('gmp-click', (event) => {
if (infowindow.isOpen) {
infowindow.close();
if (infoWindow.isOpen) {
infoWindow.close();
}
placeDetails.configureFromPlace(place);
placeDetails.style.width = "350px";
infowindow.setOptions({
infoWindow.setOptions({
content: placeDetails
});
infowindow.open({
infoWindow.open({
anchor: marker,
map: map.innerMap
});
placeDetails.addEventListener('gmp-load', () => {
map.innerMap.fitBounds(place.viewport, { top: placeDetails.offsetHeight || 206, left: 200 });
map.innerMap.fitBounds(place.viewport, { top: 400, left: 200 });
});
});
map.innerMap.setCenter(bounds.getCenter());
Expand Down
21 changes: 11 additions & 10 deletions dist/samples/ui-kit-place-search/docs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,24 @@ const placeDetails = document.querySelector("gmp-place-details") as any;
let marker = document.querySelector('gmp-advanced-marker') as any;
/* [END maps_ui_kit_place_search_query_selectors] */
let markers = {};
let infowindow;
let infoWindow;
let mapCenter;

async function initMap(): Promise<void> {
await google.maps.importLibrary("places");
const { InfoWindow } = await google.maps.importLibrary("maps") as google.maps.MapsLibrary;
const { spherical } = await google.maps.importLibrary("geometry") as google.maps.GeometryLibrary;

infowindow = new google.maps.InfoWindow;
infoWindow = new google.maps.InfoWindow;

function getContainingCircle(bounds) {
const diameter = spherical.computeDistanceBetween(
bounds.getNorthEast(),
bounds.getSouthWest()
);
return { center: bounds.getCenter(), radius: diameter / 2 };
const calculatedRadius = diameter / 2;
const cappedRadius = Math.min(calculatedRadius, 50000); // Cap the radius to avoid an error.
return { center: bounds.getCenter(), radius: cappedRadius };
}

findCurrentLocation();
Expand All @@ -41,7 +43,6 @@ async function initMap(): Promise<void> {
typeSelect.addEventListener("change", (event) => {
// First remove all existing markers.
for(marker in markers){
console.log(marker);
markers[marker].map = null;
}
markers = {};
Expand All @@ -53,7 +54,7 @@ async function initMap(): Promise<void> {
),
includedPrimaryTypes: [typeSelect.value],
}).then(addMarkers);

// Handle user selection in Place Details.
placeList.addEventListener("gmp-placeselect", ({ place }) => {
markers[place.id].click();
});
Expand All @@ -79,20 +80,20 @@ async function addMarkers(){
bounds.extend(place.location);

marker.addListener('gmp-click',(event) => {
if(infowindow.isOpen){
infowindow.close();
if(infoWindow.isOpen){
infoWindow.close();
}
placeDetails.configureFromPlace(place);
placeDetails.style.width = "350px";
infowindow.setOptions({
infoWindow.setOptions({
content: placeDetails
});
infowindow.open({
infoWindow.open({
anchor: marker,
map: map.innerMap
});
placeDetails.addEventListener('gmp-load',() => {
map.innerMap.fitBounds(place.viewport, {top: placeDetails.offsetHeight || 206, left: 200});
map.innerMap.fitBounds(place.viewport, { top: 400, left: 200 });
});

});
Expand Down
5 changes: 4 additions & 1 deletion dist/samples/ui-kit-place-search/docs/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ html,
gmp-map {
box-sizing: border-box;
padding: 0 20px 20px;
height: 600px;
}

.overlay {
position: relative;
top: 40px;
margin: 20px;
width: 400px;
}
Expand Down Expand Up @@ -55,7 +58,7 @@ html,
}

.list-container {
height: 600px;
height: 400px;
overflow: auto;
border-radius: 10px;
}
Expand Down
5 changes: 4 additions & 1 deletion dist/samples/ui-kit-place-search/jsfiddle/demo.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ html,
gmp-map {
box-sizing: border-box;
padding: 0 20px 20px;
height: 600px;
}

.overlay {
position: relative;
top: 40px;
margin: 20px;
width: 400px;
}
Expand Down Expand Up @@ -55,7 +58,7 @@ html,
}

.list-container {
height: 600px;
height: 400px;
overflow: auto;
border-radius: 10px;
}
Expand Down
1 change: 0 additions & 1 deletion dist/samples/ui-kit-place-search/jsfiddle/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
<script type="module" src="./index.js"></script>
</head>
<body>
<h1>Place List Nearby Search with Google Maps</h1>

<gmp-map center="-37.813,144.963" zoom="10" map-id="DEMO_MAP_ID">
<div class="overlay" slot="control-inline-start-block-start">
Expand Down
Loading