Reversed direction to be clockwise

For consistency with MapKit, the Google Maps SDK, and these methods’ own documentation.

Fixes #1780.
This commit is contained in:
Minh Nguyễn
2015-06-25 09:42:44 -07:00
parent 7a30a0d316
commit fc209e31c5
2 changed files with 3 additions and 3 deletions

View File

@@ -1463,7 +1463,7 @@ std::chrono::steady_clock::duration secondsAsDuration(float duration)
- (CLLocationDirection)direction
{
double direction = _mbglMap->getBearing() * -1;
double direction = _mbglMap->getBearing();
while (direction > 360) direction -= 360;
while (direction < 0) direction += 360;
@@ -1479,7 +1479,7 @@ std::chrono::steady_clock::duration secondsAsDuration(float duration)
CGFloat duration = (animated ? MGLAnimationDuration : 0);
_mbglMap->setBearing(direction * -1, secondsAsDuration(duration));
_mbglMap->setBearing(direction, secondsAsDuration(duration));
[self notifyMapChange:@(animated ? mbgl::MapChangeRegionDidChangeAnimated : mbgl::MapChangeRegionDidChange)];
}

View File

@@ -53,7 +53,7 @@
@"compass should be visible when map is rotated");
XCTAssertEqualObjects([NSValue valueWithCGAffineTransform:tester.compass.transform],
[NSValue valueWithCGAffineTransform:CGAffineTransformMakeRotation(M_PI * 1.5)],
[NSValue valueWithCGAffineTransform:CGAffineTransformMakeRotation(M_PI * 0.5)],
@"compass rotation should indicate map rotation");
}