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: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'}).addTo(map);

var polygon1 = L.polygon(
            [
              [53.38332836757156, 34.64538574218751],
			        [55.03431871502809, 36.71356201171876],
              [54.584796743678744, 37.66113281250001],
              [53.38332836757156, 34.64538574218751]
            ], 
            {
                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); })