Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Add Draggable Markers  #2450

Closed
Closed

Description

@tobrun

Google Maps allows its Markers to be draggable and allows end developers to register to events

Activity

  1. added
    Android
    on Sep 29, 2015
  2. pshustad commented on Nov 6, 2015

    @pshustad

    A workaround would at least be to provide a MapView.OnMoveListener with a onMove callback. The callback would typically be called if the view detecs a MotionEvent.ACTION_MOVE event and the event is not dispatched as a scroll event. This happens e.g. after a long-press followed by a drag.

    We are currently working on an Android Map Editor using mapbox-gl-native as the framework. However, I see no possibilities for detecting when the user tries to move a marker. With the above workaround we could detect a long-press followed by a move event and then move the marker by recreating it in the new position.

  3. added 5 commits that reference this issue on Nov 9, 2015
  4. ljbade commented on Nov 9, 2015

    @ljbade
    Contributor

    @pshustad It is possible to add your own onTouch listener to MapView from an activity since it inherits that from View.

    We used this as a work around to detect long presses until we had a chance to add a long press listener.

  5. pshustad commented on Nov 10, 2015

    @pshustad

    @ljbade Thanks for the advice. I was actually in the middle of preparing a pull request for a full-blown implementation of the OnMarkerDragListener API, but might try this workaround instead.

    Of course, if there are future plans for a Mapbox "drag marker" API, I would be happy to continue working on it.

  6. ljbade commented on Nov 10, 2015

    @ljbade
    Contributor

    @pshustad feel free to keep working on a PR if you want. I just wanted to let you know about the work around.

  7. tobrun commented on May 20, 2016

    @tobrun
    MemberAuthor

    Now that #3276 has landed this feature can be implemented using View Markers instead of GL Markers

  8. p-fischer commented on Jun 9, 2016

    @p-fischer

    Hi @tobrun ,
    could you please elaborate how you would realize draggable markers with marker views? (I was looking for a possibility to add a touch listener to a marker view but could not find any.)

  9. filipc commented on Jun 23, 2016

    @filipc

    I'm also interested how to drag Markers same way as it is possible in Google Maps.
    @tobrun please give us some suggestions or code snippet how you thought to implement it using View Markers.
    What are the development plans in this area?

  10. tobrun commented on Jun 23, 2016

    @tobrun
    MemberAuthor

    @p-fischer @filipc at this point I haven't started to think about the actual implementation or haven't discussed this internally. This feature just barely didn't make the cut for the 4.1.0 feature list and was considered a nice to have. @frederoni is working on the iOS equivalent in #5373.

    Ideally I would love to support the multi window drag/drop functionality as shown at Google I/O this year. This will require us to use the Android SDK drag and drop and not create something custom from scratch. At this point, when a drag starts we probably need to call removeMarker and re-add it again when we drop the marker.

  11. DavidMont commented on Jul 15, 2016

    @DavidMont

    I hope this will become sooner, My legacy mapbox android have draggable marker, I dont want to change/remove it from this current mapbox sdk

  12. 11 remaining items

  13. codebee commented on Mar 19, 2018

    @codebee

    Hi, Any update on for the draggable marker feature? Thanks :)

  14. Meerz commented on Apr 20, 2018

    @Meerz

    Android : any update or trick we use drag marker or point or polyline on map???
    i am stuck for four three days on drag marker or point on polyline???
    kindly help me to solve out this problem or code??

  15. vanshg commented on Apr 20, 2018

    @vanshg

    @Meerz Refer to the code I posted a few comments above. I can confirm it is still working on Mapbox 6.0.1

    @tobrun Is this feature in any future roadmap?

  16. Meerz commented on Apr 20, 2018

    @Meerz

    @vanshg thansk for quick reply i implement but here map.getSelectedMarkers(); and screenDensity cannot resolve??map not resolve
    annotation.setPosition(map.
    this also

  17. vanshg commented on Apr 20, 2018

    @vanshg

    @Meerz You will need to adjust the code I posted to match what you've named your variables. In this case, map refers to the MapboxMap instance. You can set screenDensity equal to getResources().getDisplayMetrics().density;

    Also, I believe I spoke too soon. The code I posted earlier may need a couple other modifications to work. You should be able to get rid of reflection and get rid of the try-catch (replace the reflection code with List<MarkerView> nearbyMarkers = map.getMarkerViewsInRect(tapRect);

  18. tobrun commented on Apr 23, 2018

    @tobrun
    MemberAuthor

    @vanshg yes, this is going to be implemented when we revamp the annotations api.

  19. atul-anand commented on Apr 30, 2018

    @atul-anand

    @tobrun Have you decided on the tentative release date after revamping the annotation api?

  20. Meerz commented on May 18, 2018

    @Meerz

    @tobrun any upadates regarding draggable marker???

  21. added a commit that references this issue on Jun 29, 2018
  22. tobrun commented on Jul 6, 2018

    @tobrun
    MemberAuthor

    An example how to do this with SymbolLayer in #12326

  23. added a commit that references this issue on Jul 17, 2018
  24. LukasPaczos commented on Nov 9, 2018

    @LukasPaczos
    Contributor

    Draggable markers, and annotations in general, support has been added to the Annotation Plugin in the v0.3.0, see mapbox/mapbox-plugins-android#753.

    Feel free to check out the plugin and let us know what you think, thanks!

    /cc @chloekraw

  25. tobrun commented on Jan 4, 2019

    @tobrun
    MemberAuthor

    Annotations are deprecated and are replaced by the annotations plugin. Support for dragging annotations is already implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Androidannotationsfeaturegood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions