From 99582b773ebe1b0e39240fc608135a1742b4fa73 Mon Sep 17 00:00:00 2001 From: Julian Rex Date: Mon, 12 Feb 2018 11:36:03 -0500 Subject: [ios] Made reason bitmask private, created public enum, and provided a mapping from the bitmask to enum --- platform/ios/src/MGLCameraChangeReason.h | 54 ++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 platform/ios/src/MGLCameraChangeReason.h (limited to 'platform/ios/src/MGLCameraChangeReason.h') diff --git a/platform/ios/src/MGLCameraChangeReason.h b/platform/ios/src/MGLCameraChangeReason.h new file mode 100644 index 0000000000..5fb990afdd --- /dev/null +++ b/platform/ios/src/MGLCameraChangeReason.h @@ -0,0 +1,54 @@ +#import "MGLFoundation.h" + +/** + Reasons describing why a camera move occurred. + + Values of this type are passed to the `MGLMapView`'s delegate in the following methods: + + - `-mapView:shouldChangeFromCamera:toCamera:reason:` + - `-mapView:regionWillChangeWithReason:animated:` + - `-mapView:regionIsChangingWithReason:` + - `-mapView:regionDidChangeWithReason:animated:` + + It's important to note that it's almost impossible to perform a rotate without zooming (in or out), + so when you want to check for a pan vs a rotation, it's important to ensure you check + MGLCameraChangeReasonGesturePan against MGLCameraChangeReasonGestureRotateAndZoom. +*/ +typedef NS_ENUM(NSUInteger, MGLCameraChangeReason) +{ + /// The reason for the camera change is invalid. This is considered an error. + MGLCameraChangeReasonInvalid, + + /// Set when a public API that moves the camera is called. + MGLCameraChangeReasonProgrammatic, + + /// The user panned the map. + MGLCameraChangeReasonGesturePan, + + /// The user rotated the map. This is also used when the user resets the map orientation by tapping + /// on the compass. Note that since it's almost impossible to rotate without zooming, you should + /// also check against MGLCameraChangeReasonGestureRotateAndZoom + MGLCameraChangeReasonGestureRotate, + + /// The user zoomed the map. This is used when pinching the map, double tapping and for the one + /// finger drag zoom gesture. + MGLCameraChangeReasonGestureZoom, + + /// The user panned and rotated the map, without lifting their fingers. + MGLCameraChangeReasonGesturePanAndRotate, + + /// The user rotated and zoomed the map. You will see this value when rotating the map without a + /// deliberate zoom. See also MGLCameraChangeReasonGestureRotate. + MGLCameraChangeReasonGestureRotateAndZoom, + + /// The user panned and zoomed the map, without lifting their fingers. + MGLCameraChangeReasonGesturePanAndZoom, + + /// The user panned, rotated and zoomed the map, without lifting their fingers. + MGLCameraChangeReasonGesturePanRotateAndZoom, + + /// The user dragged the map with two fingers to tilt the map. + MGLCameraChangeReasonGestureTilt +}; + + -- cgit v1.2.1