summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2016-07-10 13:44:48 -0700
committerMinh Nguyễn <mxn@1ec5.org>2017-07-05 18:32:58 -0700
commitba60e9b94cc2b6f106d15677d20f6cf796b42327 (patch)
tree993d1e560c0217e4d00860d0f89e8dd9bd269c7c
parent74bcca380dd7faa7a629d59e3346506e6a8cca34 (diff)
downloadqtlocation-mapboxgl-ba60e9b94cc2b6f106d15677d20f6cf796b42327.tar.gz
Revert "[ios] Removed MGLAnnotationView.flat"
This reverts commit f2fdc23ec7b39d1ee6c9e4b37ad4952e4a5f5447.
-rw-r--r--platform/ios/Mapbox.playground/Contents.swift1
-rw-r--r--platform/ios/app/MBXViewController.m4
-rw-r--r--platform/ios/src/MGLAnnotationView.h15
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.