-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmapApp.ts
29 lines (24 loc) · 993 Bytes
/
mapApp.ts
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
/// <reference path="./typings/index.d.ts" />
function initialize() {
var option: google.maps.MapOptions = {
center: new google.maps.LatLng(34.059,-118.39),
zoom: 12
}
var map: google.maps.Map = new google.maps.Map(document.getElementById('mapDiv'), option);
addButtons(map);
}
function addButtons(map: google.maps.Map) {
document.getElementById('btnTerrain').addEventListener('click', () => {
map.setMapTypeId(google.maps.MapTypeId.TERRAIN);
});
document.getElementById('btnRoadmap').addEventListener('click', () => {
map.setMapTypeId(google.maps.MapTypeId.ROADMAP);
});
document.getElementById('btnSatellite').addEventListener('click', () => {
map.setMapTypeId(google.maps.MapTypeId.SATELLITE);
});
document.getElementById('btnHybrid').addEventListener('click', () => {
map.setMapTypeId(google.maps.MapTypeId.HYBRID);
});
}
google.maps.event.addDomListener(window, "load", initialize);