summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2016-07-02 18:41:11 -0700
committerMinh Nguyễn <mxn@1ec5.org>2016-07-02 18:41:11 -0700
commitf2fdc23ec7b39d1ee6c9e4b37ad4952e4a5f5447 (patch)
treebade627480750c3b775e44e1dcbd3313dfef2e07
parent1f026c624668298c5736a8ba4ef480de8bab425a (diff)
downloadqtlocation-mapboxgl-f2fdc23ec7b39d1ee6c9e4b37ad4952e4a5f5447.tar.gz
[ios] Removed MGLAnnotationView.flat
Removed MGLAnnotationView’s option to lie flat against a tilted map to work around #5090.
-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
-rw-r--r--platform/ios/src/MGLAnnotationView.mm13
4 files changed, 1 insertions, 32 deletions
diff --git a/platform/ios/Mapbox.playground/Contents.swift b/platform/ios/Mapbox.playground/Contents.swift
index ed48116da9..b1b11e5e34 100644
--- a/platform/ios/Mapbox.playground/Contents.swift
+++ b/platform/ios/Mapbox.playground/Contents.swift
@@ -75,7 +75,6 @@ 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 cd5694d835..ed312e87a2 100644
--- a/platform/ios/app/MBXViewController.m
+++ b/platform/ios/app/MBXViewController.m
@@ -589,10 +589,6 @@ static NSString * const MBXViewControllerAnnotationViewReuseIdentifer = @"MBXVie
annotationView.frame = CGRectMake(0, 0, 10, 10);
annotationView.centerColor = [UIColor whiteColor];
- // 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 make the annotation view draggable
// also note that having two long press gesture recognizers on overlapping views (`self.view` & `annotationView`) will cause weird behaviour
// comment out the pin dropping functionality in the handleLongPress: method in this class to make draggable annotation views play nice
diff --git a/platform/ios/src/MGLAnnotationView.h b/platform/ios/src/MGLAnnotationView.h
index a568aaa6b3..ff23cbefb7 100644
--- a/platform/ios/src/MGLAnnotationView.h
+++ b/platform/ios/src/MGLAnnotationView.h
@@ -127,21 +127,6 @@ 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.
diff --git a/platform/ios/src/MGLAnnotationView.mm b/platform/ios/src/MGLAnnotationView.mm
index 3bbe2fcc84..656b1c0f3e 100644
--- a/platform/ios/src/MGLAnnotationView.mm
+++ b/platform/ios/src/MGLAnnotationView.mm
@@ -71,23 +71,12 @@
return;
}
- if (self.flat)
- {
- [self updatePitch:pitch];
- }
-
if (self.scalesWithViewingDistance)
{
[self updateScaleForPitch:pitch];
}
}
-- (void)updatePitch:(CGFloat)pitch
-{
- CATransform3D t = CATransform3DRotate(CATransform3DIdentity, MGLRadiansFromDegrees(pitch), 1.0, 0, 0);
- self.layer.transform = t;
-}
-
- (void)updateScaleForPitch:(CGFloat)pitch
{
CGFloat superviewHeight = CGRectGetHeight(self.superview.frame);
@@ -112,7 +101,7 @@
// reduction is then normalized for a scale of 1.0.
CGFloat pitchAdjustedScale = 1.0 - maxScaleReduction * pitchIntensity;
- CATransform3D transform = self.flat ? self.layer.transform : CATransform3DIdentity;
+ CATransform3D transform = self.layer.transform;
self.layer.transform = CATransform3DScale(transform, pitchAdjustedScale, pitchAdjustedScale, 1);
}
}