Leaflet/Leaflet.draw — pull request #249 by atombender (2013-12-19 20:47:25+00:00)
Title: Improve polyline/polygon drawing by accepting some motion on click

This change improves polyline/polygon drawing by accepting clicks that involve a little bit of mouse motion.

The problem is that Leaflet.draw will miss most of the points if one quickly (or even not terribly quickly) tries to draw a shape such as a polygon. This is because clicking using a physical mounse typically introduces a little bit of motion to the on-screen mouse cursor. Such clicks will be perceived as a map move event, not a draw click.

The solution is to hook `mousedown` rather than `click`, and track the distance of the motion when `mouseup` is received.