summaryrefslogtreecommitdiff
path: root/platform/ios/src/MGLMapView.mm
diff options
context:
space:
mode:
Diffstat (limited to 'platform/ios/src/MGLMapView.mm')
-rw-r--r--platform/ios/src/MGLMapView.mm23
1 files changed, 16 insertions, 7 deletions
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index 216464a7d4..da94e46d16 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -5955,12 +5955,8 @@ public:
{
// Smoothly move the user location annotation view and callout view to
// the new location.
- [UIView animateWithDuration:duration
- delay:0
- options:(UIViewAnimationOptionCurveLinear |
- UIViewAnimationOptionAllowUserInteraction |
- UIViewAnimationOptionBeginFromCurrentState)
- animations:^{
+
+ dispatch_block_t animation = ^{
if (self.selectedAnnotation == self.userLocation)
{
UIView <MGLCalloutView> *calloutView = self.calloutViewForSelectedAnnotation;
@@ -5969,7 +5965,20 @@ public:
userPoint.y - annotationView.center.y);
}
annotationView.center = userPoint;
- } completion:NULL];
+ };
+
+ if (duration > 0) {
+ [UIView animateWithDuration:duration
+ delay:0
+ options:(UIViewAnimationOptionCurveLinear |
+ UIViewAnimationOptionAllowUserInteraction |
+ UIViewAnimationOptionBeginFromCurrentState)
+ animations:animation
+ completion:NULL];
+ }
+ else {
+ animation();
+ }
_userLocationAnimationCompletionDate = [NSDate dateWithTimeIntervalSinceNow:duration];
annotationView.hidden = NO;