jacobtoye/Leaflet.draw — pull request #5 by mphasize (2012-07-11 10:21:39+00:00)
Title: Touch Support for Drawing Tools

Hi Jacob,

I had some time to do the rest of the touch support for Leaflet.Draw. I did some cleanup and improvements and while there's still more things to be considered, all drawing tools should work properly on multitouch browsers. (Well, actually I have only iOS devices for testing, but touch api should be similar on Android.)

So here's the details:
- registration of touch events is conditional based on L.Browser.touch
- same goes for label texts "tap" or "click" and iconSize of polyline/polygon handlers
- there's a touch target multiplier, so that a small invisible area around the marker is still a valid touch target
- touch move events prevent the map from panning while you're trying to draw something

More ideas:
- As you point out in issue #3, all those touch markers are very confusing. I would suggest to keep all the markers, though not clickable and very small, and have the marker that finishes drawing stand out by making it the big one. (Maybe even use an icon on it?)
- Hints: With mouse interaction it makes sense to have the hints following the mouse cursor, but in touch interaction there's no hovering, so this turns out to be a problem – especially the first hint (explaining how to start). I think it makes sense to show the hints in a static location, somewhere along the top of the map (so that they're not hidden by the users hand). At the very least, all the hints need to be positioned above the finger, instead of below.

So far. I hope you like the work.
Cheers!
Marcus