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.

Draggable annotation views #5036

Closed
Closed

Description

@1ec5

Like MKAnnotationView in MapKit, MGLAnnotationView should have a draggable property that, when set to YES, allows the user the relocate the annotation by long-pressing on it and dragging it. During the dragging gesture, the map remains still. (MKPinAnnotationView additionally levitates slightly above the map while being dragged and animates the beginning and end of the gesture.)

The Android SDK equivalent of this feature is being tracked in #2450.

/cc @boundsj

Activity

  1. 1ec5 commented on May 14, 2016

    @1ec5
    ContributorAuthor

    Until this feature is implemented, the workaround is to keep track of the annotation yourself; when the user long-presses at a given location, check if the gesture took place at the annotation’s coordinates. If it did, set the map view’s scrollEnabled to NO and install your own pan gesture recognizer that changes the annotation’s coordinates.

  2. added
    annotationsAnnotations on iOS and macOS or markers on Android
    on May 17, 2016
  3. added a commit that references this issue on Jun 7, 2016
  4. frederoni commented on Jun 7, 2016

    @frederoni
    Contributor

    Just pushed a branch that seems to be working well. It's still WiP as I'm not aware of all the implications.

    I'm hesitating about if the view should handle updating the position or if that should be delegated back to the implementer through MGLMapViewDelegate or MGLAnnotationViewDelegate (annotationViewWasDraggedToLocation:) but that would prevent an otherwise very simple implementation of draggable views by just changing one property.

    I do get the concerns about using two gesture recognizers per view but I don't see any performance decrease comparing 1000 draggable vs 1000 non-draggable annotation views.

    Not a fan of updating the mapView property on the annotationView in MGLMapView -updateAnnotationViews so let me know if you have any good ideas how to get around that.

  5. added 4 commits that reference this issue on Jun 15, 2016
    9257dd8
    5efaf14
    cbee7ff
    d29bef9
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

    annotationsAnnotations on iOS and macOS or markers on AndroidfeatureiOSMapbox Maps SDK for iOS

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions