Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draggable Markers #21

Closed
haydenflinner opened this issue Mar 27, 2018 · 8 comments
Closed

Draggable Markers #21

haydenflinner opened this issue Mar 27, 2018 · 8 comments

Comments

@haydenflinner
Copy link

Is there an easy way to make markers draggable around the map? I tried with a GestureDetector and using onPanDown, but the problem is once the marker is released you get screen coordinates and not GPS coordinates.

@johnpryan
Copy link
Collaborator

not currently. This feature would involve other things too (like moving the map when the marker is at the edge)

We could expose gesture detection handlers through the public API to make this work once https://github.com/apptreesoftware/flutter_map/issues/10 is added

@haydenflinner
Copy link
Author

Sounds good!

In case anyone finds this issue in the future: one workaround is to allow some sort of edit mode triggered by longpressing on a marker, where you then grab wherever the user next taps on the map and move the marker to that spot.

@avioli
Copy link
Contributor

avioli commented Apr 11, 2018

If the MapState is exposed you can then call its project and unproject methods to convert between screen points and map coordinates.

@johnpryan
Copy link
Collaborator

This should be possible using the Plugin api, which exposes the full MapState object, and allows you write custom layers: https://github.com/apptreesoftware/flutter_map/blob/master/flutter_map_example/lib/pages/plugin_api.dart

@Firman95
Copy link

@avioli Draggable widget only gives me offset. How to convert offset to Point object?

@angel1st
Copy link

Is that feature (Draggable Marker) already implemented? If yes - any example hint how it might be used ?

@johnpryan
Copy link
Collaborator

Not that I'm aware of. If someone would like to contribute an example I can re-purpose this issue for that.

@ibrierley
Copy link
Collaborator

If anyone is still interested in this, I've started a draggable marker plugin over at https://github.com/ibrierley/flutter_map_dragmarker/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants