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.

Selecting an off-screen annotation doesn't work #9790

Closed

Description

@ivanmkc

Platform:
iOS 9
Mapbox SDK version:
3.6.1

Steps to trigger behavior

  1. Plot a bunch of annotations
  2. Programmatically select an annotation that is far offscreen (if it's close and offscreen, selection seems to work)
  3. Programatically call setCenter to pan the map to the annotation

Expected behavior

  1. The annotation selected should appear selected
  2. The mapView(_ mapView: MGLMapView, didSelect annotation: MGLAnnotation) delegate function of MGLMapViewDelegate should fire.

Actual behavior

1 and 2 do not happen. Only when the annotation is very close by (even offscreen works sometimes)

Activity

  1. added
    iOS
    on Aug 17, 2017
  2. added
    annotations
    on Aug 17, 2017
  3. settl commented on Sep 3, 2017

    @settl

    +1, I'm having the same issue. Do you have any plans to work on this?

  4. friedbunny commented on Sep 5, 2017

    @friedbunny
    Contributor

    Though I don’t recall the reasons (@boundjs and @1ec5 would know), not selecting off-screen annotations is intentional and documented:

    If the given annotation is not visible within the current viewport, this method has no effect.

  5. 1ec5 commented on Sep 6, 2017

    @1ec5
    Contributor

    It might make sense to change the behavior so that selecting an off-screen annotation moves the annotation into view, similar to calling -[MGLMapView showAnnotation:]. That is, the camera changes so that the annotation becomes visible at the same time it is selected. This wasn’t possible before #6676, because the annotation would immediately get deselected as soon as the camera moved. But now that we have the ability to keep the callout open, we could have off-screen selection work and solve #3249 at the same time.

  6. added this to the milestone on Dec 20, 2017
  7. julianrex commented on Feb 16, 2018

    @julianrex
    Contributor

    It only seems to be the selectedAnnotations property that checks for offscreen, -selectAnnotation:animated: does not. @1ec5 What was the reason for checking offscreen?

  8. 1ec5 commented on Feb 20, 2018

    @1ec5
    Contributor

    Not sure. It could be a remnant of a limitation that has since been fixed. I think we should try to match MapKit’s behavior in this regard if possible.

  9. modified the milestones: , ios-v3.7.7 on Mar 12, 2018
  10. modified the milestones: ios-v3.7.7, on Apr 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

annotationsiOS

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions