summaryrefslogtreecommitdiff
path: root/platform/ios/app/MBXAnnotationView.m
diff options
context:
space:
mode:
Diffstat (limited to 'platform/ios/app/MBXAnnotationView.m')
-rw-r--r--platform/ios/app/MBXAnnotationView.m33
1 files changed, 17 insertions, 16 deletions
diff --git a/platform/ios/app/MBXAnnotationView.m b/platform/ios/app/MBXAnnotationView.m
index c181211431..61f9b1c047 100644
--- a/platform/ios/app/MBXAnnotationView.m
+++ b/platform/ios/app/MBXAnnotationView.m
@@ -1,28 +1,16 @@
#import "MBXAnnotationView.h"
@interface MBXAnnotationView ()
-
-@property (nonatomic) UIView *centerView;
-
@end
@implementation MBXAnnotationView
- (void)layoutSubviews {
[super layoutSubviews];
- if (!self.centerView) {
- self.backgroundColor = [UIColor blueColor];
- self.centerView = [[UIView alloc] initWithFrame:CGRectInset(self.bounds, 1.0, 1.0)];
- self.centerView.backgroundColor = self.centerColor;
- [self addSubview:self.centerView];
- }
-}
-
-- (void)setCenterColor:(UIColor *)centerColor {
- if (![_centerColor isEqual:centerColor]) {
- _centerColor = centerColor;
- self.centerView.backgroundColor = centerColor;
- }
+
+ self.layer.borderColor = [UIColor blueColor].CGColor;
+ self.layer.borderWidth = 1;
+ self.layer.cornerRadius = 2;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
@@ -51,6 +39,7 @@
case MGLAnnotationViewDragStateCanceling:
break;
case MGLAnnotationViewDragStateEnding: {
+ self.transform = CGAffineTransformScale(CGAffineTransformIdentity, 2, 2);
[UIView animateWithDuration:.4 delay:0 usingSpringWithDamping:.4 initialSpringVelocity:.5 options:UIViewAnimationOptionCurveLinear animations:^{
self.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1, 1);
} completion:nil];
@@ -60,5 +49,17 @@
}
+- (nullable id<CAAction>)actionForLayer:(CALayer *)layer forKey:(NSString *)event
+{
+ if (([event isEqualToString:@"transform"] || [event isEqualToString:@"position"])
+ && self.dragState == MGLAnnotationViewDragStateNone)
+ {
+ CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:event];
+ animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
+ animation.speed = 0.1;
+ return animation;
+ }
+ return [super actionForLayer:layer forKey:event];
+}
@end