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

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

Closed
ivanmkc opened this issue Aug 17, 2017 · 5 comments
Closed

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

ivanmkc opened this issue Aug 17, 2017 · 5 comments
Assignees
Labels
annotations Annotations on iOS and macOS or markers on Android iOS Mapbox Maps SDK for iOS

Comments

@ivanmkc
Copy link

ivanmkc commented Aug 17, 2017

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)

@tobrun tobrun added the iOS Mapbox Maps SDK for iOS label Aug 17, 2017
@fabian-guerra fabian-guerra added the annotations Annotations on iOS and macOS or markers on Android label Aug 17, 2017
@settl
Copy link

settl commented Sep 3, 2017

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

@friedbunny
Copy link
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.

@1ec5
Copy link
Contributor

1ec5 commented Sep 6, 2017

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.

@akitchen akitchen added this to the ios-v4.0.0 milestone Dec 20, 2017
@julianrex
Copy link
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?

@1ec5
Copy link
Contributor

1ec5 commented Feb 20, 2018

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.

julianrex pushed a commit that referenced this issue Feb 20, 2018
@lilykaiser lilykaiser modified the milestones: ios-v4.0.0, ios-v3.7.7 Mar 12, 2018
julianrex pushed a commit that referenced this issue Mar 16, 2018
julianrex pushed a commit that referenced this issue Mar 21, 2018
@friedbunny friedbunny modified the milestones: ios-v3.7.7, ios-v4.0.0 Apr 17, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
annotations Annotations on iOS and macOS or markers on Android iOS Mapbox Maps SDK for iOS
Projects
None yet
Development

No branches or pull requests

9 participants