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

Animated MGLMapView methods should accept completion handlers #1581

Closed
1ec5 opened this issue May 18, 2015 · 5 comments
Closed

Animated MGLMapView methods should accept completion handlers #1581

1ec5 opened this issue May 18, 2015 · 5 comments
Assignees
Labels
feature GL JS parity For feature parity with Mapbox GL JS iOS Mapbox Maps SDK for iOS

Comments

@1ec5
Copy link
Contributor

1ec5 commented May 18, 2015

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.

@1ec5 1ec5 added the iOS Mapbox Maps SDK for iOS label May 18, 2015
1ec5 added a commit that referenced this issue Sep 4, 2015
Plumbed camera options all the way through to MGLMapView. Added a method that lets you specify a direction in addition to center point and zoom level.

Added Map::jumpTo() for parity with mapbox-gl-js. Replaced usage of Map::setLatLng() and Map::setLatLngZoom() with Map::jumpTo() or Map::easeTo() within MGLMapView. Replaced MGLMapView.pitch with MGLMapCamera for setting all supported degrees of freedom simultaneously. Simultaneously move and rotate with course.

Support customizable timing functions on iOS.

iosapp now persists an archived MGLMapCamera instead of separate viewpoint properties and also synchronizes user defaults on termination. This change implements persistence entirely in Objective-C, eliminating the use of the Objective-C++ implementation.

Fixes #1643, fixes #1834. Ref #1581.
1ec5 added a commit that referenced this issue Sep 7, 2015
Plumbed camera options all the way through to MGLMapView. Added a method that lets you specify a direction in addition to center point and zoom level.

Added Map::jumpTo() for parity with mapbox-gl-js. Replaced usage of Map::setLatLng() and Map::setLatLngZoom() with Map::jumpTo() or Map::easeTo() within MGLMapView. Replaced MGLMapView.pitch with MGLMapCamera for setting all supported degrees of freedom simultaneously. Simultaneously move and rotate with course.

Support customizable timing functions on iOS.

iosapp now persists an archived MGLMapCamera instead of separate viewpoint properties and also synchronizes user defaults on termination. This change implements persistence entirely in Objective-C, eliminating the use of the Objective-C++ implementation.

Fixes #1643, fixes #1834. Ref #1581.
@jhoughjr
Copy link

jhoughjr commented Sep 8, 2015

Here here!

@kdgwill-zz
Copy link

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
Copy link

+1

@1ec5 1ec5 added feature GL JS parity For feature parity with Mapbox GL JS labels Oct 6, 2015
@1ec5
Copy link
Contributor Author

1ec5 commented Oct 6, 2015

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.

AndwareSsj pushed a commit to AndwareSsj/mapbox-gl-native that referenced this issue Nov 6, 2015
Plumbed camera options all the way through to MGLMapView. Added a method that lets you specify a direction in addition to center point and zoom level.

Added Map::jumpTo() for parity with mapbox-gl-js. Replaced usage of Map::setLatLng() and Map::setLatLngZoom() with Map::jumpTo() or Map::easeTo() within MGLMapView. Replaced MGLMapView.pitch with MGLMapCamera for setting all supported degrees of freedom simultaneously. Simultaneously move and rotate with course.

Support customizable timing functions on iOS.

iosapp now persists an archived MGLMapCamera instead of separate viewpoint properties and also synchronizes user defaults on termination. This change implements persistence entirely in Objective-C, eliminating the use of the Objective-C++ implementation.

Fixes mapbox#1643, fixes mapbox#1834. Ref mapbox#1581.
@1ec5
Copy link
Contributor Author

1ec5 commented Nov 20, 2015

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.

1ec5 added a commit that referenced this issue Nov 20, 2015
Added transition frame and finish functions to CameraOptions. Added Objective-C equivalents to the three main entry points to easeTo() in MGLMapView.

Fixes #1581.
@1ec5 1ec5 self-assigned this Nov 20, 2015
1ec5 added a commit that referenced this issue Nov 25, 2015
Added transition frame and finish functions to CameraOptions. Added Objective-C equivalents to the three main entry points to easeTo() in MGLMapView.

Fixes #1581.
@1ec5 1ec5 removed the in progress label Nov 25, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature GL JS parity For feature parity with Mapbox GL JS iOS Mapbox Maps SDK for iOS
Projects
None yet
Development

No branches or pull requests

4 participants