Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlya Grechuhin <i.grechuhin@mapswithme.com>2015-06-22 16:36:08 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:52:47 +0300
commit4bd9e204c971becb23798b39f28b32c6e41e31f8 (patch)
tree009a81e924692840bd85b6925e50809d00d4eaa5 /iphone/Maps/Classes/MWMSpringAnimation.mm
parent83ebe0e2de836e0a9a1256c522c394aa39cd874a (diff)
[ios] Fixed iPhone portrait PP scroll.
Diffstat (limited to 'iphone/Maps/Classes/MWMSpringAnimation.mm')
-rw-r--r--iphone/Maps/Classes/MWMSpringAnimation.mm16
1 files changed, 13 insertions, 3 deletions
diff --git a/iphone/Maps/Classes/MWMSpringAnimation.mm b/iphone/Maps/Classes/MWMSpringAnimation.mm
index 47211011ef..6959784a8a 100644
--- a/iphone/Maps/Classes/MWMSpringAnimation.mm
+++ b/iphone/Maps/Classes/MWMSpringAnimation.mm
@@ -14,17 +14,18 @@
@property (nonatomic) CGPoint velocity;
@property (nonatomic) CGPoint targetPoint;
@property (nonatomic) UIView * view;
+@property (copy, nonatomic) MWMSpringAnimationCompletionBlock completion;
@end
@implementation MWMSpringAnimation
-+ (instancetype)animationWithView:(UIView *)view target:(CGPoint)target velocity:(CGPoint)velocity
++ (instancetype)animationWithView:(UIView *)view target:(CGPoint)target velocity:(CGPoint)velocity completion:(MWMSpringAnimationCompletionBlock)completion
{
- return [[self alloc] initWithView:view target:target velocity:velocity];
+ return [[self alloc] initWithView:view target:target velocity:velocity completion:completion];
}
-- (instancetype)initWithView:(UIView *)view target:(CGPoint)target velocity:(CGPoint)velocity
+- (instancetype)initWithView:(UIView *)view target:(CGPoint)target velocity:(CGPoint)velocity completion:(MWMSpringAnimationCompletionBlock)completion
{
self = [super init];
if (self)
@@ -32,6 +33,7 @@
self.view = view;
self.targetPoint = target;
self.velocity = velocity;
+ self.completion = completion;
}
return self;
}
@@ -58,7 +60,15 @@
{
self.view.center = self.targetPoint;
*finished = YES;
+ if (self.completion)
+ self.completion();
}
}
++ (CGFloat)approxTargetFor:(CGFloat)startValue velocity:(CGFloat)velocity
+{
+ CGFloat const decelaration = (velocity > 0 ? -1.0 : 1.0) * 300.0;
+ return startValue - (velocity * velocity) / (2.0 * decelaration);
+}
+
@end