2013-06-04 23:27:42 +08:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
2016-04-29 17:35:50 +08:00
|
|
|
<title>Leaflet debug page</title>
|
2013-06-04 23:27:42 +08:00
|
|
|
|
2016-04-29 17:35:50 +08:00
|
|
|
<link rel="stylesheet" href="../../dist/leaflet.css" />
|
2013-06-04 23:27:42 +08:00
|
|
|
|
2016-04-29 17:35:50 +08:00
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
2013-06-04 23:27:42 +08:00
|
|
|
|
2016-04-29 17:35:50 +08:00
|
|
|
<link rel="stylesheet" href="../css/screen.css" />
|
2013-06-04 23:27:42 +08:00
|
|
|
|
2016-04-29 17:35:50 +08:00
|
|
|
<script type="text/javascript" src="../../build/deps.js"></script>
|
|
|
|
<script src="../leaflet-include.js"></script>
|
2013-06-04 23:27:42 +08:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
2016-04-29 17:35:50 +08:00
|
|
|
<div id="map"></div>
|
|
|
|
<button id="populate">Populate with 10 markers</button>
|
2013-06-04 23:27:42 +08:00
|
|
|
|
2016-04-29 17:35:50 +08:00
|
|
|
<script type="text/javascript">
|
2013-06-04 23:27:42 +08:00
|
|
|
|
|
|
|
var map = L.map('map').setView([36.9, -95.4], 5);
|
|
|
|
map.on('contextmenu', function (e) {
|
|
|
|
alert('The map has been right-clicked');
|
|
|
|
});
|
|
|
|
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
|
2014-03-04 23:54:41 +08:00
|
|
|
attribution: '© <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors',
|
2013-06-04 23:27:42 +08:00
|
|
|
}).addTo(map);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var exampleGeoJSON = {
|
|
|
|
type: 'Polygon',
|
|
|
|
coordinates: [
|
|
|
|
[
|
|
|
|
[-90.0, 35.0],
|
|
|
|
[-90.0, 45.0],
|
|
|
|
[-100.0, 45.0],
|
|
|
|
[-100.0, 35.0]
|
|
|
|
]
|
|
|
|
]
|
|
|
|
};
|
|
|
|
|
|
|
|
var geoJsonLayer = L.geoJson(exampleGeoJSON, {
|
|
|
|
onEachFeature: function (feature, layer) {
|
|
|
|
layer.on('contextmenu', function (e) {
|
|
|
|
alert('The GeoJSON layer has been clicked');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}).addTo(map);
|
|
|
|
|
|
|
|
var marker = L.marker([36, -95]).addTo(map);
|
|
|
|
marker.bindPopup('Right-click me <br> to test contextmenu <br> event capture').openPopup();
|
|
|
|
|
|
|
|
|
2016-04-29 17:35:50 +08:00
|
|
|
</script>
|
2013-06-04 23:27:42 +08:00
|
|
|
</body>
|
|
|
|
</html>
|