Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation
import MapKit
import MapConductorCore
@_spi(MapConductorDriver) import MapConductorCore

private let converter = MapKitZoomAltitudeConverter(zoom0Altitude: 171_319_879.0)
private let mapKitMaxPitch: Double = 80.9
Expand Down Expand Up @@ -30,7 +30,7 @@ public extension MapCameraPosition {
? Spherical.computeOffset(
origin: position,
distance: distance * tan(pitchRadians),
heading: bearing
heading: CameraBearing.toNativeHeading(bearing)
)
: position

Expand All @@ -42,7 +42,7 @@ public extension MapCameraPosition {
),
fromDistance: distance,
pitch: nativePitch,
heading: bearing
heading: CameraBearing.toNativeHeading(bearing)
)
}
}
Expand Down Expand Up @@ -95,7 +95,7 @@ public extension MKMapView {
return MapCameraPosition(
position: position,
zoom: zoom,
bearing: camera.heading,
bearing: CameraBearing.bearingFromNativeHeading(camera.heading),
tilt: logicalTilt,
visibleRegion: visibleRegion
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation
import CoreLocation
import MapKit
import MapConductorCore
@_spi(MapConductorDriver) import MapConductorCore
import QuartzCore
import UIKit

Expand Down Expand Up @@ -228,12 +228,12 @@ final class MapKitViewController: MapViewControllerProtocol {
// Use UIView.animate to respect the specified duration
UIView.animate(withDuration: duration) {
mapView.setVisibleMapRect(rect, edgePadding: .zero, animated: false)
Self.applyHeading(position.bearing, center: centerCoordinate, to: mapView, animated: false)
Self.applyHeading(CameraBearing.toNativeHeading(position.bearing), center: centerCoordinate, to: mapView, animated: false)
}
} else {
// Use MapKit's default animation or no animation
mapView.setVisibleMapRect(rect, edgePadding: .zero, animated: animated)
Self.applyHeading(position.bearing, center: centerCoordinate, to: mapView, animated: animated)
Self.applyHeading(CameraBearing.toNativeHeading(position.bearing), center: centerCoordinate, to: mapView, animated: animated)
}

return true
Expand Down
Loading