forked from code4history/Maplat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi_release.html
49 lines (49 loc) · 1.43 KB
/
api_release.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Maplat</title>
<meta content="yes" name="apple-mobile-web-app-capable">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
<link rel="icon" type="image/png" href="parts/favicon.png">
<link rel="stylesheet" href="dist/maplat_core.css">
<style>
.mainview {
position: absolute;
top: 5%;
bottom: 5%;
left: 5%;
right: 5%;
}
</style>
</head>
<body>
<div class="mainview">
<div id="map_div"></div>
</div>
</body>
<script src="dist/maplat_core.js"></script>
<script>
var option = {};
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for (var i = 0; i < hashes.length; i++) {
hash = hashes[i].split('=');
option[hash[0]] = hash[1] == 'true' ? true : hash[1] == 'false' ? false : hash[1];
}
Maplat.createObject(option).then(function(app){
app.addEventListener('clickMarker', function(evt) {
console.log(evt);
});
app.addEventListener('clickMap', function (evt) {
console.log(evt);
});
app.addLine({
lnglats: [[141.151995, 39.701599], [141.151137, 39.703736], [141.1521671, 39.7090232]],
stroke: {
color: '#ffcc33',
width: 2
}
});
});
</script>
</html>