diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2017-02-09 13:49:04 -0800 |
---|---|---|
committer | Fabian Guerra Soto <fabian.guerra@mapbox.com> | 2017-02-09 16:49:04 -0500 |
commit | 272dc3f6a91ee1f0734c6642d610366f4396ec93 (patch) | |
tree | 9c5f89949ea38cd27cbc1c2eff89109e4c3a40c9 /platform/macos/src/MGLMapViewDelegate.h | |
parent | b6e5edc26844df6a5f1f6e34881826828d36ce6a (diff) | |
download | qtlocation-mapboxgl-272dc3f6a91ee1f0734c6642d610366f4396ec93.tar.gz |
Delegate method to restrict movement (#5584)
* [ios, macos] Added delegate method to restrict movement
Added a way for the delegate to restrict where the user can move within the map using gestures.
Fixes #2457.
* [ios] Added support to restrict movement in pinch/rotate gestures
* [ios] Added support to restrict movement in double tap/quick zoom/two finger drag gestures
* [ios] fixed camera reset before two finger drag gesture is complete
* [ios] fixed camera comparison in double tap gestures
* [ios] Changelog update
* [macos] Changelog updated
* [ios, macos] Changelog cleanup
* [ios, macos] Added documentation to clarify performance impact
* [ios] clarified variable name
* [ios] blocking gestures implementation changed to a predictive approach
* [ios] gesture delegate methods refactoring
* [ios] Removed duplicated methods, improved code readability
* [ios] code refactoring to clarify the conditions to execute a gesture
Diffstat (limited to 'platform/macos/src/MGLMapViewDelegate.h')
-rw-r--r-- | platform/macos/src/MGLMapViewDelegate.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/platform/macos/src/MGLMapViewDelegate.h b/platform/macos/src/MGLMapViewDelegate.h index 534e28e3a8..08a9f7eff4 100644 --- a/platform/macos/src/MGLMapViewDelegate.h +++ b/platform/macos/src/MGLMapViewDelegate.h @@ -61,6 +61,28 @@ NS_ASSUME_NONNULL_BEGIN */ - (void)mapView:(MGLMapView *)mapView cameraDidChangeAnimated:(BOOL)animated; +/** + Asks the delegate whether the map view should be allowed to change from the + existing camera to the new camera in response to a user gesture. + + This method is called as soon as the user gesture is recognized. It is not + called in response to a programmatic camera change, such as by setting the + `centerCoordinate` property or calling `-flyToCamera:completionHandler:`. + + This method is called many times during gesturing, so you should avoid performing + complex or performance-intensive tasks in your implementation. + + @param mapView The map view that the user is manipulating. + @param oldCamera The camera representing the viewpoint at the moment the + gesture is recognized. If this method returns `NO`, the map view’s camera + continues to be this camera. + @param newCamera The expected camera after the gesture completes. If this + method returns `YES`, this camera becomes the map view’s camera. + @return A Boolean value indicating whether the map view should stay at + `oldCamera` or change to `newCamera`. + */ +- (BOOL)mapView:(MGLMapView *)mapView shouldChangeFromCamera:(MGLMapCamera *)oldCamera toCamera:(MGLMapCamera *)newCamera; + #pragma mark Loading the Map /** |