-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
89 lines (74 loc) · 2.45 KB
/
index.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
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
<!DOCTYPE html>
<html>
<head>
<title>Leaflet Quick Start Guide Example</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="dist/leaflet.css" />
</head>
<body>
<div style="position:relative;">
<div id="map" style="width: 600px; height: 400px"></div>
<div
style="position:absolute;
top:0px;
left:600px;
height: 400px;
line-height: 400px;
width:200px;
background-color:#D69380;
color:#55227F;
text-align: center;
font-size: 24px;
font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;
font-weight:bold"
onclick="togglePlay()">
start / stop
</div>
</div>
<script src="dist/leaflet-src.js"></script>
<script>
var rotation = Math.PI/8;
var map = L.map('map').setView([51.505, -0.09], 13).setRotation(rotation);
L.tileLayer('https://{s}.tiles.mapbox.com/v3/{id}/{z}/{x}/{y}.png', {
maxZoom: 18,
attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
'<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
'Imagery © <a href="http://mapbox.com">Mapbox</a>',
id: 'examples.map-i875mjb7'
}).addTo(map);
L.marker([51.5, -0.09]).addTo(map)
.bindPopup("<b>Hello world!</b><br />I am a popup.").openPopup();
L.circle([51.508, -0.11], 500, {
color: 'red',
fillColor: '#f03',
fillOpacity: 0.5
}).addTo(map).bindPopup("I am a circle.");
L.polygon([
[51.509, -0.08],
[51.503, -0.06],
[51.51, -0.047]
]).addTo(map).bindPopup("I am a polygon.");
var popup = L.popup();
function onMapClick(e) {
popup
.setLatLng(e.latlng)
.setContent("You clicked the map at " + e.latlng.toString())
.openOn(map);
}
map.on('click', onMapClick);
var interval;
function togglePlay() {
if(interval) {
clearInterval(interval);
interval = undefined;
} else {
interval = setInterval(function(){
rotation = (rotation + (Math.PI/8)) % (Math.PI*2);
map.setRotation(rotation);
}, 500);
}
}
</script>
</body>
</html>