I have drawn a rectangle marker in the map using leaflet. When i zoom in the map the rectangle marker automatically becomes large. But i don't want that. I want that the width of the marker may increase but the height of the marker should remain as it is. How can i do that in leaflet? Here is my code
map2.setView([outputf[0].lat,outputf[0].lon], 9);
// Code to rectange
var latLng = L.latLng(outputf[0].lat, outputf[0].lon);
var currentPoint = map2.latLngToContainerPoint(latLng);
var W = 20;
var H = 12*map2.getZoom()/9;
var xDifference = W / 2;
var yDifference = H / 2;
var southWest = L.point((currentPoint.x - xDifference), (currentPoint.y - yDifference));
var northEast = L.point((currentPoint.x + xDifference), (currentPoint.y + yDifference));
var bounds = L.latLngBounds(map2.containerPointToLatLng(southWest),map2.containerPointToLatLng(northEast));
L.rectangle(bounds,{color: "black", opacity:.6, weight: 2,fillColor: "red",id:dir}).bindPopup('WorkZone is: '+output[ax].key).addTo(map2).on('click', onClick);
W denotes the width and H denotes the Height of rectangle. I was trying with
var H = 12*map2.getZoom()/9;
But it doesn't work at all.