diff options
-rw-r--r-- | platform/ios/Mapbox.playground/Contents.swift | 1 | ||||
-rw-r--r-- | platform/ios/app/MBXViewController.m | 4 | ||||
-rw-r--r-- | platform/ios/src/MGLAnnotationView.h | 15 |
3 files changed, 20 insertions, 0 deletions
diff --git a/platform/ios/Mapbox.playground/Contents.swift b/platform/ios/Mapbox.playground/Contents.swift index 1f368be73b..8f4c574fc1 100644 --- a/platform/ios/Mapbox.playground/Contents.swift +++ b/platform/ios/Mapbox.playground/Contents.swift @@ -118,6 +118,7 @@ class MapDelegate: NSObject, MGLMapViewDelegate { let av = PlaygroundAnnotationView(reuseIdentifier: "annotation") av.frame = CGRect(x: 0, y: 0, width: 30, height: 30) av.centerOffset = CGVector(dx: -15, dy: -15) + av.flat = true let centerView = UIView(frame: CGRectInset(av.bounds, 3, 3)) centerView.backgroundColor = UIColor.whiteColor() av.addSubview(centerView) diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m index 29c5c65012..2fb38a5350 100644 --- a/platform/ios/app/MBXViewController.m +++ b/platform/ios/app/MBXViewController.m @@ -1720,6 +1720,10 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { // method in this class to make draggable annotation views play nice. annotationView.draggable = YES; + // uncomment to flatten the annotation view against the map when the map is tilted + // this currently causes severe performance issues when more than 2k annotations are visible + // annotationView.flat = YES; + // Uncomment to force annotation view to maintain a constant size when // the map is tilted. By default, annotation views will shrink and grow // as they move towards and away from the horizon. Relatedly, annotations diff --git a/platform/ios/src/MGLAnnotationView.h b/platform/ios/src/MGLAnnotationView.h index 2802d31b05..2a1a118d76 100644 --- a/platform/ios/src/MGLAnnotationView.h +++ b/platform/ios/src/MGLAnnotationView.h @@ -155,6 +155,21 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationViewDragState) { @property (nonatomic) CGVector centerOffset; /** + A Boolean value indicating whether the view lies flat against the map as it + tilts. + + If this option is unset, the annotation view remains unchanged as the map’s + pitch increases, so that the view appears to stand upright on the tilted map. + If this option is set, the annotation view tilts as the map’s pitch increases, + so that the view appears to lie flat against the tilted map. + + For example, you would set this option if the annotation view depicts an arrow + that should always point due south. You would unset this option if the arrow + should always point down towards the ground. + */ +@property (nonatomic, assign, getter=isFlat) BOOL flat; + +/** A Boolean value that determines whether the annotation view grows and shrinks as the distance between the viewpoint and the annotation view changes on a tilted map. |