Skip to content

Commit d14ab2d

Browse files
[Backport release/v0.17] fix compass in horizontal orientation (#8492)
GitOrigin-RevId: e37f541084d616d4ded6546397c097d4c6503b7b
1 parent 9fa9612 commit d14ab2d

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Mapbox welcomes participation and contributions from everyone.
88

99
### Features ✨ and improvements 🏁
1010
* Promote Geofencing APIs to stable. Remove `@_spi(Experimental)` from Geofencing APIs.
11+
* Fix an issue where the location indicator could show incorrect direction in landscape orientation.
1112

1213
## 11.17.0-rc.2 - 21 November, 2025
1314

Sources/MapboxMaps/Location/LocationManager.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,8 @@ func adjust(heading: Heading, toViewOrientation orientation: UIInterfaceOrientat
289289
let adjustment: CLLocationDirection = switch orientation {
290290
case .portrait: 0
291291
case .portraitUpsideDown: 180
292-
case .landscapeLeft: 90 // home button on the right side
293-
case .landscapeRight: -90 // home button on the left side
292+
case .landscapeLeft: -90 // home button on the left side
293+
case .landscapeRight: 90 // home button on the right side
294294
case .unknown: 0
295295
@unknown default: 0
296296
}

Tests/MapboxMapsTests/Location/LocationManagerTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,10 @@ final class LocationManagerTests: XCTestCase {
229229
XCTAssertEqual(portraitUpsideDownResult.direction, 225)
230230

231231
let landscapeLeftResult = adjust(heading: baseHeading, toViewOrientation: .landscapeLeft)
232-
XCTAssertEqual(landscapeLeftResult.direction, 135)
232+
XCTAssertEqual(landscapeLeftResult.direction, 315)
233233

234234
let landscapeRightResult = adjust(heading: baseHeading, toViewOrientation: .landscapeRight)
235-
XCTAssertEqual(landscapeRightResult.direction, 315)
235+
XCTAssertEqual(landscapeRightResult.direction, 135)
236236

237237
let unknownResult = adjust(heading: baseHeading, toViewOrientation: .unknown)
238238
XCTAssertEqual(unknownResult.direction, 45)

0 commit comments

Comments
 (0)