[ios] Allow annotation views to be flattened (#5067)

* [ios] wip flatten annotation view

* [ios] wip flatten annotation view

* [ios] naming conventions

* [ios] removed unused property
This commit is contained in:
frederoni
2016-05-18 17:03:08 -07:00
committed by Minh Nguyễn
parent 5fe43e43f2
commit a220efcae6
6 changed files with 56 additions and 3 deletions

View File

@@ -1,11 +1,11 @@
#import "MGLAnnotationView.h"
#import "MGLAnnotationView_Private.h"
#import "MGLMapView.h"
@interface MGLAnnotationView ()
@property (nonatomic) id<MGLAnnotation> annotation;
@property (nonatomic, readwrite, nullable) NSString *reuseIdentifier;
@end
@implementation MGLAnnotationView
@@ -34,10 +34,26 @@
}
- (void)setCenter:(CGPoint)center
{
[self setCenter:center pitch:0];
}
- (void)setCenter:(CGPoint)center pitch:(CGFloat)pitch
{
center.x += _centerOffset.dx;
center.y += _centerOffset.dy;
[super setCenter:center];
if (_flat) {
[self updatePitch:pitch];
}
}
- (void)updatePitch:(CGFloat)pitch
{
CATransform3D t = CATransform3DRotate(CATransform3DIdentity, MGLRadiansFromDegrees(pitch), 1.0, 0, 0);
self.layer.transform = t;
}
- (id<CAAction>)actionForLayer:(CALayer *)layer forKey:(NSString *)event