2014-01-22 02:32:47 +08:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Leaflet debug page</title>
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="../../dist/leaflet.css" />
|
|
|
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="../css/screen.css" />
|
|
|
|
<style>
|
|
|
|
#map {
|
|
|
|
width: 600px;
|
|
|
|
height: 400px;
|
|
|
|
}
|
2015-05-11 22:54:46 +08:00
|
|
|
button {
|
|
|
|
min-width: 3em;
|
|
|
|
text-align: center;
|
|
|
|
}
|
2014-01-22 02:32:47 +08:00
|
|
|
</style>
|
|
|
|
|
|
|
|
<script type="text/javascript" src="../../build/deps.js"></script>
|
|
|
|
<script src="../leaflet-include.js"></script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<div id="map"></div>
|
|
|
|
|
2015-05-11 22:54:46 +08:00
|
|
|
<div style="position: absolute; left: 620px; top: 10px; z-index: 500">
|
2015-05-12 20:19:40 +08:00
|
|
|
<div><button id="dc">DC</button>(flyTo)</div>
|
|
|
|
<div><button id="sf">SF</button>(setView, 5 sec)</div>
|
2015-05-11 22:54:46 +08:00
|
|
|
<div><button id="trd">TRD</button>(flyTo 20 sec)</div>
|
|
|
|
<div><button id="lnd">LND</button>(fract. zoom)</div>
|
|
|
|
<div><button id="kyiv">KIEV</button>(setView, fract. zoom)</div>
|
2015-11-09 19:40:21 +08:00
|
|
|
<div><button id="mad">MAD</button>(fitBounds)</div>
|
2015-05-12 20:19:40 +08:00
|
|
|
<div><button id="nul">NUL</button>(image overlay)</div>
|
2015-05-11 22:54:46 +08:00
|
|
|
<div><button id="stop">stop</button></div>
|
2015-05-12 20:19:40 +08:00
|
|
|
<table>
|
|
|
|
<tr><td>on movestart</td><td id='movestart'></td></tr>
|
|
|
|
<tr><td>on zoomstart</td><td id='zoomstart'></td></tr>
|
|
|
|
<tr><td>on move</td><td id='move'></td></tr>
|
|
|
|
<tr><td>on moveend</td><td id='moveend'></td></tr>
|
|
|
|
<tr><td>on zoomend</td><td id='zoomend'></td></tr>
|
2014-01-22 02:32:47 +08:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
|
|
var kyiv = [50.5, 30.5],
|
2015-05-11 22:54:46 +08:00
|
|
|
lnd = [51.51, -0.12],
|
2014-01-22 02:32:47 +08:00
|
|
|
sf = [37.77, -122.42],
|
2015-05-11 22:54:46 +08:00
|
|
|
dc = [38.91, -77.04],
|
2015-11-09 19:40:21 +08:00
|
|
|
trd = [63.41, 10.41],
|
|
|
|
madBounds = [[40.70, -4.19], [40.12, -3.31]],
|
|
|
|
mad = [40.40, -3.7];
|
2014-01-22 02:32:47 +08:00
|
|
|
|
|
|
|
var map = L.map('map').setView(dc, 10);
|
|
|
|
|
2015-09-09 20:03:12 +08:00
|
|
|
var positron = L.tileLayer('http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png', {
|
|
|
|
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, © <a href="http://cartodb.com/attributions">CartoDB</a>'
|
2014-01-22 02:32:47 +08:00
|
|
|
}).addTo(map);
|
|
|
|
|
2015-11-09 19:40:21 +08:00
|
|
|
var path = new L.Polyline([kyiv, trd, lnd, mad, dc, sf]).addTo(map);
|
|
|
|
|
2014-01-22 02:32:47 +08:00
|
|
|
var marker1 = L.marker(kyiv).addTo(map),
|
2015-05-11 22:54:46 +08:00
|
|
|
marker2 = L.marker(lnd).addTo(map);
|
2015-05-12 20:19:40 +08:00
|
|
|
marker3 = L.marker(dc).addTo(map),
|
|
|
|
marker4 = L.marker(sf).addTo(map),
|
2015-11-09 19:40:21 +08:00
|
|
|
marker5 = L.marker(trd).addTo(map),
|
|
|
|
marker6 = L.marker(mad).addTo(map);
|
2014-01-22 02:32:47 +08:00
|
|
|
|
2015-05-12 20:19:40 +08:00
|
|
|
var nullIslandKitten = L.imageOverlay('http://placekitten.com/g/300/400', [[-0.2,-0.15], [0.2, 0.15]]).addTo(map);
|
|
|
|
|
|
|
|
document.getElementById('dc').onclick = function () { map.flyTo(dc, 10); };
|
2015-10-12 20:02:30 +08:00
|
|
|
document.getElementById('sf').onclick = function () { map.setView(sf, 10, {duration: 5, animate: true}); };
|
2015-05-12 20:19:40 +08:00
|
|
|
document.getElementById('trd').onclick = function () { map.flyTo(trd, 10, {duration: 20}); };
|
|
|
|
document.getElementById('lnd').onclick = function () { map.flyTo(lnd, 9.25); };
|
2015-05-11 22:54:46 +08:00
|
|
|
document.getElementById('kyiv').onclick = function () { map.setView(kyiv, 9.25); };
|
2015-05-12 20:19:40 +08:00
|
|
|
document.getElementById('nul').onclick = function () { map.flyTo([0, 0], 10); };
|
2015-11-09 19:40:21 +08:00
|
|
|
document.getElementById('mad').onclick = function () { map.fitBounds(madBounds); };
|
2014-03-20 05:34:31 +08:00
|
|
|
document.getElementById('stop').onclick = function () { map.stop(); };
|
2014-01-22 02:32:47 +08:00
|
|
|
|
|
|
|
function logEvent(e) { console.log(e.type); }
|
|
|
|
|
2015-05-12 20:19:40 +08:00
|
|
|
function attachMoveEvent(name) {
|
|
|
|
map.on(name, function(){
|
|
|
|
document.getElementById(name).innerHTML = map.getCenter() + ' z' + map.getZoom();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
attachMoveEvent('movestart');
|
|
|
|
attachMoveEvent('zoomstart');
|
|
|
|
attachMoveEvent('move');
|
|
|
|
attachMoveEvent('moveend');
|
|
|
|
attachMoveEvent('zoomend');
|
2014-01-22 02:32:47 +08:00
|
|
|
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|