Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Position puck in lower portion of screen. #92

Merged
merged 1 commit into from
Aug 14, 2024
Merged
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
- Merged in <https://github.com/maplibre/maplibre-navigation-ios/pull/47>
* Fix: NavigationViewController displayed incorrect `speedMultiplier` when using SimulatedLocationManager
- Merged in <https://github.com/maplibre/maplibre-navigation-ios/pull/49>
* Adjusted the camera during navigation to show more of what's "ahead" in the route - effectively moving the puck lower on the screen. As before, see `NavigationMapViewCourseTrackingDelegate.updateCamera(_:location:,routeProgress:)` if you want to customize this behavior.
- Merged in <https://github.com/maplibre/maplibre-navigation-ios/pull/92>

## v2.0.0 (May 23, 2023)
* Upgrade minimum iOS version from 11.0 to 12.0.
Expand Down
7 changes: 6 additions & 1 deletion MapboxNavigation/NavigationMapView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,12 @@
if !cameraUpdated {
let newCamera = MLNMapCamera(lookingAtCenter: location.coordinate, acrossDistance: self.altitude, pitch: 45, heading: location.course)
let function = CAMediaTimingFunction(name: CAMediaTimingFunctionName.linear)
setCamera(newCamera, withDuration: 1, animationTimingFunction: function, edgePadding: UIEdgeInsets.zero, completionHandler: nil)

// Because it's more useful to show what's ahead than what's behind, we bias the camera to put
// the user location puck in the lower portion of the visible map, showing more of what's ahead.
let edgePadding = UIEdgeInsets(top: bounds.height * 0.4 - safeAreaInsets.bottom, left: 0, bottom: 0, right: 0)

setCamera(newCamera, withDuration: 1, animationTimingFunction: function, edgePadding: edgePadding, completionHandler: nil)
}
}

Expand Down Expand Up @@ -743,7 +748,7 @@
}
}

// TODO: Change to point-based distance calculation

Check warning on line 751 in MapboxNavigation/NavigationMapView.swift

View workflow job for this annotation

GitHub Actions / Code Style

TODOs should be resolved (Change to point-based distance...) (todo)
private func waypoints(on routes: [Route], closeTo point: CGPoint) -> [Waypoint]? {
let tapCoordinate = convert(point, toCoordinateFrom: self)
let multipointRoutes = routes.filter { $0.routeOptions.waypoints.count >= 3 }
Expand Down
Loading