summaryrefslogtreecommitdiff
path: root/platform/ios/src/MGLAnnotationView.h
diff options
context:
space:
mode:
authorFredrik Karlsson <bjorn.fredrik.karlsson@gmail.com>2016-06-24 19:42:20 +0200
committerGitHub <noreply@github.com>2016-06-24 19:42:20 +0200
commitd29bef957fe117158077a5af223d3cee14032ee2 (patch)
treec6f975fbf0bc4bf224643813a5e4117049704b1f /platform/ios/src/MGLAnnotationView.h
parent05b6e724935277920a2c5f8282993b50d26f9719 (diff)
downloadqtlocation-mapboxgl-d29bef957fe117158077a5af223d3cee14032ee2.tar.gz
[ios] fixes #5036 draggable annotation views (#5373)
Diffstat (limited to 'platform/ios/src/MGLAnnotationView.h')
-rw-r--r--platform/ios/src/MGLAnnotationView.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/platform/ios/src/MGLAnnotationView.h b/platform/ios/src/MGLAnnotationView.h
index 3b44432dc0..18e4985884 100644
--- a/platform/ios/src/MGLAnnotationView.h
+++ b/platform/ios/src/MGLAnnotationView.h
@@ -6,6 +6,14 @@ NS_ASSUME_NONNULL_BEGIN
@protocol MGLAnnotation;
+typedef NS_ENUM(NSUInteger, MGLAnnotationViewDragState) {
+ MGLAnnotationViewDragStateNone = 0, // View is sitting on the map.
+ MGLAnnotationViewDragStateStarting, // View is beginning to drag.
+ MGLAnnotationViewDragStateDragging, // View is being dragged.
+ MGLAnnotationViewDragStateCanceling, // View dragging was cancelled and will be returned to its starting positon.
+ MGLAnnotationViewDragStateEnding // View was dragged.
+};
+
/** The MGLAnnotationView class is responsible for representing point-based annotation markers as a view. Annotation views represent an annotation object, which is an object that corresponds to the MGLAnnotation protocol. When an annotation’s coordinate point is visible on the map view, the map view delegate is asked to provide a corresponding annotation view. If an annotation view is created with a reuse identifier, the map view may recycle the view when it goes offscreen. */
@interface MGLAnnotationView : UIView
@@ -70,6 +78,25 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, assign, getter=isEnabled) BOOL enabled;
/**
+ Setting this property to YES will make the view draggable. Long-press followed by a pan gesture will start to move the
+ view around the map. `-mapView:didDragAnnotationView:toCoordinate:` will be called when a view is dropped.
+ */
+@property (nonatomic, assign, getter=isDraggable) BOOL draggable;
+
+/**
+ All states are handled automatically when `draggable` is set to YES.
+ Custom animations can be achieved by overriding setDragState:animated:
+ */
+@property (nonatomic, readonly) MGLAnnotationViewDragState dragState;
+
+/**
+ Called when the `dragState` changes.
+
+ Implementer may override this method in order to customize animations in subclasses.
+ */
+- (void)setDragState:(MGLAnnotationViewDragState)dragState animated:(BOOL)animated NS_REQUIRES_SUPER;
+
+/**
Setting this property to YES will cause the annotation view to shrink as it approaches the horizon and grow as it moves away from the
horizon when the associated map view is tilted. Conversely, setting this property to NO will ensure that the annotation view maintains
a constant size even when the map view is tilted. To maintain consistency with annotation representations that are not backed by an