-
Notifications
You must be signed in to change notification settings - Fork 0
/
dining.js
95 lines (92 loc) · 2.6 KB
/
dining.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
var markersmain = [];
export function dining(map, markers){
const iconBase =
"http://maps.google.com/mapfiles/kml/shapes/";
const icons = {
parking: {
icon: iconBase + "parking_lot_maps.png",
},
bus: {
icon: iconBase + "bus_maps.png",
},
gas: {
icon: iconBase + "gas_stations_maps.png",
},
compost: {
icon: iconBase + "shopping_maps.png",
},
dining: {
icon: iconBase + "dining_maps.png",
},
};
const dining = [
{
position: {lat: 41.561798, lng: -72.650945},
title: "Grown Café",
type: "dining",
},
{
position: {lat: 41.557475, lng: -72.650565},
title: "Red & Black Café",
type: "dining",
},
{
position: {lat: 41.554778102723084, lng: -72.65498871239876},
title: "Star and Crescent Eating Club",
type: "dining",
},
{
position: {lat: 41.55391442793207, lng: -72.65358478074275},
title: "WesWings",
type: "dining",
},
{
position: {lat: 41.552269, lng: -72.655065},
title: "Summerfields",
type: "dining",
},
{
position: {lat: 41.553348, lng: -72.657833},
title: "Pi Café",
type: "dining",
},
{
position: {lat: 41.553874, lng: -72.658509},
title: "WesShop",
type: "dining",
},
{
position: {lat: 41.556929, lng: -72.656868},
title: "Usdan Marketplace, Usdan Café, Daniel Family Commons",
type: "dining",
},
];
dining.forEach(({position, title, type}, i) => {
const marker = new google.maps.Marker({
position: position,
icon: icons[type].icon,
});
marker.addListener("click", () => {
map.setZoom(17);
map.setCenter(marker.getPosition());
});
markersmain = markers;
marker.setMap(null)
document.getElementById("diningBtn").addEventListener("click", hideMarkers);
document.getElementById("diningBtn").addEventListener("click", setMarker);
function setMarker(){
map.setZoom(15)
map.setCenter({ lat: 41.556240724638144, lng: -72.65683037211356 })
marker.setMap(map)
}
markersmain.push(marker);
});
}
function setMapOnAll(map) {
for (let i = 0; i < markersmain.length; i++) {
markersmain[i].setMap(map);
}
}
function hideMarkers() {
setMapOnAll(null);
}