Leaflet/Leaflet.draw — pull request #62 by thatjpk (2013-01-18 02:45:25+00:00)
Title: Adds markerOffset option to L.Marker.Draw

When placing a marker with L.Marker.Draw, the tip of the marker follows the mouse cursor's position. I wanted the tip of the mouse cursor to be closer to the top of the marker similar to how a user would naturally drag a marker around. It would also solve a problem I was having where I couldn't get clicks to make it through to the map because of things I had in the way.

So I added a markerOffset option to L.Marker.Draw. By default, there is no offset and the previous behavior is preserved. But when markerOffset is set to an instance of L.Point, it uses the point's x and y values as offsets for the marker from the cursor. For example, ```new L.Marker.Draw(map, {markerOffset: new L.Point(0,28)});``` makes the mouse cursor sit at about the white circle in the center of the default Leaflet marker image and you hover around with it. On click, the location that the 'draw:marker-created' event contains is where the tip of the marker was when the click happened.