big polygon
by Leo
HTML
<script src="//cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.4/leaflet.js"></script>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.4/leaflet.css">
<body>
<div id="map" ></div>
</body>
CSS
html, body, #map {
margin: 0;
width: 100%;
height: 100%;
}
JavaScript
var map = new L.Map('map', {
center: new L.LatLng(45.040216, 38.975996),
zoom: 4
});
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'}).addTo(map);
var polygon1 = L.polygon(
[
[53.192870243632626, 34.39819335937501],
[51.303145259199084, 37.85888671875001],
[55.753960, 37.620393],
[53.192870243632626, 34.39819335937501]
],
{
fillColor: 'red',
fillOpacity: 0.2,
"nonBubblingEvents": []
});
map.addLayer(polygon1);
map.addEventListener('click', function(e){ console.log("map ", e); })
polygon1.addEventListener('click', function(e){ console.log("red polygon ", e); })