summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Rex <julian.rex@mapbox.com>2018-09-12 23:15:26 -0400
committerJason Wray <jason@mapbox.com>2018-09-25 18:41:00 -0700
commitd9ef7c7b43104d5678d693da4d1043357e99cd5b (patch)
tree0f81a6d534abb3eece412d105bb042323e644662
parentb626ad40ddec5924ae7fcefcf774941f36bb363a (diff)
downloadqtlocation-mapboxgl-d9ef7c7b43104d5678d693da4d1043357e99cd5b.tar.gz
Update user puck center position immediately if duration is 0.
-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;