You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Animated MGLMapView methods should accept completion handlers #1581
Methods like -[MGLMapView setCenterCoordinate:animated:] should have corresponding methods that take completion handlers (callback blocks) as parameters, like -[MGLMapView setCenterCoordinate:animated:completionHandler:]. Completion handlers feel much more natural in modern Objective-C and especially Swift, and they’d make it much easier to chain together animated changes to the map.
GL JS can do this; so should the iOS SDK. The most straightforward way to implement it would be to have CameraOptions hold a C++ lambda that we can stuff the completion handler block into. Then easeTo() can plumb that through to the animation code’s completion code. I’m not sure what effect cancellation will have on this approach, though. For one thing, #2313 is still outstanding.
does their at least exist a work around to determine when an mapbox animation has been completed?
@kdgwill, -[MGLMapViewDelegate mapView:regionDidChangeAnimated:] is already available; it gets called for both programmatic and user-initiated region changes. It is possible to chain animations using that callback, but of course the completion handlers proposed here would be more convenient for that use case.
Activity
CameraOptions
CameraOptions
jhoughjr commentedon Sep 8, 2015
Here here!
kdgwill-zz commentedon Oct 6, 2015
Was their any further discussion on this, or does their at least exist a work around to determine when an mapbox animation has been completed?
robipresotto commentedon Oct 6, 2015
+1
1ec5 commentedon Oct 6, 2015
GL JS can do this; so should the iOS SDK. The most straightforward way to implement it would be to have
CameraOptionshold a C++ lambda that we can stuff the completion handler block into. TheneaseTo()can plumb that through to the animation code’s completion code. I’m not sure what effect cancellation will have on this approach, though. For one thing, #2313 is still outstanding.CameraOptions
1ec5 commentedon Nov 20, 2015
@kdgwill,
-[MGLMapViewDelegate mapView:regionDidChangeAnimated:]is already available; it gets called for both programmatic and user-initiated region changes. It is possible to chain animations using that callback, but of course the completion handlers proposed here would be more convenient for that use case.[core] [iOS] Completion handlers for animated methods
[core] [iOS] Completion handlers for animated methods