From fc209e31c5452f0595c815c5948f3307ef585d10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Thu, 25 Jun 2015 09:42:44 -0700 Subject: [PATCH] Reversed direction to be clockwise MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For consistency with MapKit, the Google Maps SDK, and these methods’ own documentation. Fixes #1780. --- platform/ios/MGLMapView.mm | 4 ++-- test/ios/MapViewTests.m | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm index def2af8711b..cf2274e2b06 100644 --- a/platform/ios/MGLMapView.mm +++ b/platform/ios/MGLMapView.mm @@ -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; @@ -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)]; } diff --git a/test/ios/MapViewTests.m b/test/ios/MapViewTests.m index ed378877c80..90447680ae2 100644 --- a/test/ios/MapViewTests.m +++ b/test/ios/MapViewTests.m @@ -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"); }