2012-12-28 04:37:57 +08:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Leaflet debug page</title>
|
|
|
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="../../dist/leaflet.css" />
|
|
|
|
<!--[if lte IE 8]><link rel="stylesheet" href="../../dist/leaflet.ie.css" /><![endif]-->
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="../css/screen.css" />
|
|
|
|
<script type='text/javascript' src='http://code.jquery.com/jquery-1.8.0.js'></script>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
L_PREFER_CANVAS = true;
|
|
|
|
$(document).ready(function() {
|
2013-02-18 03:17:44 +08:00
|
|
|
var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
|
|
|
|
cloudmadeAttribution = 'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 CloudMade',
|
|
|
|
cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 18, attribution: cloudmadeAttribution});
|
|
|
|
|
2012-12-28 04:37:57 +08:00
|
|
|
var map = L.map('map', {
|
|
|
|
minZoom: 1,
|
|
|
|
maxZoom: 19,
|
|
|
|
center: [51.505, -0.09],
|
2013-02-18 03:17:44 +08:00
|
|
|
zoom: 9,
|
|
|
|
layers: [cloudmade]
|
2012-12-28 04:37:57 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
var polygons = new L.FeatureGroup();
|
|
|
|
var points = [[51.505, -0.01], [51.505, -0.09], [51.55, -0.09]];
|
|
|
|
|
|
|
|
polygons.addLayer(
|
|
|
|
new L.Polyline(
|
|
|
|
points, {
|
2013-02-18 03:17:44 +08:00
|
|
|
weight: 10,
|
2012-12-28 04:37:57 +08:00
|
|
|
opacity: 1,
|
|
|
|
smoothFactor: 1,
|
2013-02-18 03:17:44 +08:00
|
|
|
color: 'red',
|
|
|
|
clickable:true
|
2012-12-28 04:37:57 +08:00
|
|
|
}));
|
|
|
|
|
|
|
|
polygons.on('click', function(m) {
|
|
|
|
// m.layer is the clicked polygon here
|
|
|
|
//m.layer.bindPopup('hello!').openPopup();
|
|
|
|
console.log(m.layer)
|
|
|
|
});
|
|
|
|
|
|
|
|
polygons.addTo(map);
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2013-02-18 03:17:44 +08:00
|
|
|
|
|
|
|
<script type="text/javascript" src="../../build/deps.js"></script>
|
2012-12-28 04:37:57 +08:00
|
|
|
<script src="../leaflet-include.js"></script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div id="map"></div>
|
|
|
|
</body>
|
|
|
|
</html>
|