Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
Reversed direction to be clockwise
Browse files Browse the repository at this point in the history
For consistency with MapKit, the Google Maps SDK, and these methods’ own documentation.

Fixes #1780.
  • Loading branch information
1ec5 committed Jun 25, 2015
1 parent 7a30a0d commit fc209e3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions platform/ios/MGLMapView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1463,7 +1463,7 @@ - (void)zoomToSouthWestCoordinate:(CLLocationCoordinate2D)southWestCoordinate no

- (CLLocationDirection)direction
{
double direction = _mbglMap->getBearing() * -1;
double direction = _mbglMap->getBearing();

while (direction > 360) direction -= 360;
while (direction < 0) direction += 360;
Expand All @@ -1479,7 +1479,7 @@ - (void)setDirection:(CLLocationDirection)direction animated:(BOOL)animated

CGFloat duration = (animated ? MGLAnimationDuration : 0);

_mbglMap->setBearing(direction * -1, secondsAsDuration(duration));
_mbglMap->setBearing(direction, secondsAsDuration(duration));

[self notifyMapChange:@(animated ? mbgl::MapChangeRegionDidChangeAnimated : mbgl::MapChangeRegionDidChange)];
}
Expand Down
2 changes: 1 addition & 1 deletion test/ios/MapViewTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ - (void)testDirectionSet {
@"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");
}

Expand Down

0 comments on commit fc209e3

Please sign in to comment.