summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2016-04-26 00:02:59 -0700
committerMinh Nguyễn <mxn@1ec5.org>2016-04-26 00:16:20 -0700
commit27f77b6bfa6b41676c2df3bb8b18fd902d4c6951 (patch)
treefae9798b0e0deed7b583593e37c24a697eb23f86
parentcf2ef5b40bccb9e3e071b4dfdca194f1c2fef85e (diff)
downloadqtlocation-mapboxgl-27f77b6bfa6b41676c2df3bb8b18fd902d4c6951.tar.gz
[ios] Hide compass from VoiceOver when pointing north
Fixes #4820.
-rw-r--r--platform/ios/src/MGLMapView.mm13
1 files changed, 7 insertions, 6 deletions
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index f2107eb3c9..671fd51ef4 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -434,7 +434,6 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
_compassView.alpha = 0;
_compassView.userInteractionEnabled = YES;
[_compassView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleCompassTapGesture:)]];
- _compassView.isAccessibilityElement = YES;
_compassView.accessibilityTraits = UIAccessibilityTraitButton;
_compassView.accessibilityLabel = NSLocalizedStringWithDefaultValue(@"COMPASS_A11Y_LABEL", nil, nil, @"Compass", @"Accessibility label");
_compassView.accessibilityHint = NSLocalizedStringWithDefaultValue(@"COMPASS_A11Y_HINT", nil, nil, @"Rotates the map to face due north", @"Accessibility hint");
@@ -4278,12 +4277,14 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
- (void)updateCompass
{
- CLLocationDirection degrees = mbgl::util::wrap(-self.direction, 0., 360.);
- self.compassView.transform = CGAffineTransformMakeRotation(MGLRadiansFromDegrees(degrees));
+ CLLocationDirection direction = self.direction;
+ CLLocationDirection plateDirection = mbgl::util::wrap(-direction, 0., 360.);
+ self.compassView.transform = CGAffineTransformMakeRotation(MGLRadiansFromDegrees(plateDirection));
- self.compassView.accessibilityValue = [_accessibilityCompassFormatter stringFromDirection:self.direction];
+ self.compassView.isAccessibilityElement = direction > 0;
+ self.compassView.accessibilityValue = [_accessibilityCompassFormatter stringFromDirection:direction];
- if (_mbglMap->getBearing() && self.compassView.alpha < 1)
+ if (direction > 0 && self.compassView.alpha < 1)
{
[UIView animateWithDuration:MGLAnimationDuration
delay:0
@@ -4294,7 +4295,7 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
}
completion:nil];
}
- else if (_mbglMap->getBearing() == 0 && self.compassView.alpha > 0)
+ else if (direction == 0 && self.compassView.alpha > 0)
{
[UIView animateWithDuration:MGLAnimationDuration
delay:0