summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Wray <jason@mapbox.com>2017-09-06 16:24:26 -0400
committerJason Wray <jason@mapbox.com>2017-09-07 19:23:30 -0400
commit59076c830051e1fde26c6353406b04748a7c9b00 (patch)
tree0be367a1fcab64cd7b21c8b4e175ed6391dc250a
parentcb1309a253b7a9dd203817510a56cee0f0157889 (diff)
downloadqtlocation-mapboxgl-59076c830051e1fde26c6353406b04748a7c9b00.tar.gz
[ios] Disable implicit animation of heading indicators
The update steps for the heading indicator are typically small, so animations tend to pile up and cause performance issues. Disabling actions is a slight regression when it comes to large steps (they're not animated now, where they previously were) and this should eventually be addressed. Also consistently use provided API for disabling CATransaction actions.
-rw-r--r--platform/ios/src/MGLFaux3DUserLocationAnnotationView.m11
1 files changed, 8 insertions, 3 deletions
diff --git a/platform/ios/src/MGLFaux3DUserLocationAnnotationView.m b/platform/ios/src/MGLFaux3DUserLocationAnnotationView.m
index 158bb01d8e..7001569b30 100644
--- a/platform/ios/src/MGLFaux3DUserLocationAnnotationView.m
+++ b/platform/ios/src/MGLFaux3DUserLocationAnnotationView.m
@@ -71,7 +71,7 @@
{
// disable implicit animation
[CATransaction begin];
- [CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions];
+ [CATransaction setDisableActions:YES];
CATransform3D t = CATransform3DRotate(CATransform3DIdentity, MGLRadiansFromDegrees(self.mapView.camera.pitch), 1.0, 0, 0);
self.layer.sublayerTransform = t;
@@ -261,7 +261,12 @@
// Don't rotate if the change is imperceptible.
if (fabs(rotation) > MGLUserLocationHeadingUpdateThreshold)
{
+ [CATransaction begin];
+ [CATransaction setDisableActions:YES];
+
_headingIndicatorLayer.affineTransform = CGAffineTransformRotate(CGAffineTransformIdentity, rotation);
+
+ [CATransaction commit];
}
}
}
@@ -283,10 +288,10 @@
_accuracyRingLayer.hidden = NO;
// disable implicit animation of the accuracy ring, unless triggered by a change in accuracy
- id shouldDisableActions = (_oldHorizontalAccuracy == self.userLocation.location.horizontalAccuracy) ? (id)kCFBooleanTrue : (id)kCFBooleanFalse;
+ BOOL shouldDisableActions = _oldHorizontalAccuracy == self.userLocation.location.horizontalAccuracy;
[CATransaction begin];
- [CATransaction setValue:shouldDisableActions forKey:kCATransactionDisableActions];
+ [CATransaction setDisableActions:shouldDisableActions];
_accuracyRingLayer.bounds = CGRectMake(0, 0, accuracyRingSize, accuracyRingSize);
_accuracyRingLayer.cornerRadius = accuracyRingSize / 2;