1

So I made a simple leaflet map that has the Leaflet Draw plugin. I am only allowing users to add a marker. Leaflet is supposed to be mobile friendly, but when I open my website in a smartphone (Galaxy s5 chrome browser app), I cannot touch to create a marker on draw:created. Is there a specific procedure necessary to adapt the draw plugin for mobile touch events?

I looked at https://github.com/tablackmore/Leaflet.draw/tree/touch and tried to redirect my page to a new index which uses the "touch" draw plugin instead of the original plugin but still nothing is "drawing". This could be because it is not directing. I am using this script reference http://www.inmotionhosting.com/support/website/redirects/mobile-redirect. I want to redirect my site to mobile.html rather than index.html. Regardless of whether my redirect works or not, shouldn't the basic draw plugin work on mobile?

Does anyone have a working example of a leaflet map on a mobile device with drawing capabilities?

For what it's worth here is my project- but it is a novice example and quite messy: http://terpconnect.umd.edu/~melrose/DVA/index.html

PS. This map shows test data only- no real data is displayed.

1 Answer 1

1

The draw plugin currently has no touch support. This is a much-asked-for feature, but it's not currently available.

You can use the Leaflet plugin "Simple Marker" which works perfectly fine with a mobile device. (only tested on iOS devices though). This plugin is only limited to drawing new points/markers. No polygon or line support, but your original question didn't specify those unsupported features.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.