Skip to content

Commit

Permalink
Merge branch 'main' into NAVIOS-1437
Browse files Browse the repository at this point in the history
  • Loading branch information
kried authored Feb 16, 2024
2 parents d04f6a7 + 33275ec commit 089eb78
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 43 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}

Expand All @@ -48,6 +48,6 @@ jobs:
/usr/bin/xcodebuild build -project /Users/runner/work/mapbox-navigation-ios/mapbox-navigation-ios/MapboxNavigation-SPM.xcodeproj -target Example CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
### Map

* Fixed a possible crash that could happen when displaying the route with the same source, midpoint, and destination. ([#4576](https://github.com/mapbox/mapbox-navigation-ios/pull/4576))
* Fixed an incorrect viewport padding in the overview route camera. ([#4593](https://github.com/mapbox/mapbox-navigation-ios/pull/4593))

### User interface

Expand Down
49 changes: 36 additions & 13 deletions Sources/MapboxNavigation/NavigationViewportDataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,11 @@ public class NavigationViewportDataSource: ViewportDataSource {
.map({ $0.shape?.coordinates })
let untraveledCoordinatesOnCurrentStep = routeProgress.currentLegProgress.currentStepProgress.remainingStepCoordinates()
let remainingCoordinatesOnRoute = coordinatesAfterCurrentStep.flatten() + untraveledCoordinatesOnCurrentStep
let carPlayCameraPadding = mapView.safeArea + UIEdgeInsets.centerEdgeInsets

var carPlayCameraPadding = mapView.safeArea + UIEdgeInsets.centerEdgeInsets
// NOTE: We need this extra padding in CarPlay to avoid overlap of the route, street name labels, and control buttons.
carPlayCameraPadding.top += 20 // destination pin
carPlayCameraPadding.bottom += 38.0 // way name view
let overviewCameraOptions = options.overviewCameraOptions

if overviewCameraOptions.pitchUpdatesAllowed || overviewMobileCamera.pitch == nil {
Expand All @@ -389,17 +393,7 @@ public class NavigationViewportDataSource: ViewportDataSource {
overviewCarPlayCamera.center = center
}
}

if overviewCameraOptions.zoomUpdatesAllowed || overviewMobileCamera.zoom == nil {
overviewMobileCamera.zoom = zoom(remainingCoordinatesOnRoute,
edgeInsets: viewportPadding,
maxZoomLevel: overviewCameraOptions.maximumZoomLevel)

overviewCarPlayCamera.zoom = zoom(remainingCoordinatesOnRoute,
edgeInsets: carPlayCameraPadding,
maxZoomLevel: overviewCameraOptions.maximumZoomLevel)
}


overviewMobileCamera.anchor = anchor(bounds: mapView.bounds,
edgeInsets: viewportPadding)

Expand All @@ -426,6 +420,19 @@ public class NavigationViewportDataSource: ViewportDataSource {
overviewMobileCamera.bearing = !isWalking ? bearing : headingDirection
overviewCarPlayCamera.bearing = bearing
}

if overviewCameraOptions.zoomUpdatesAllowed || overviewMobileCamera.zoom == nil {
overviewMobileCamera.zoom = overviewCameraZoom(remainingCoordinatesOnRoute,
pitch: overviewMobileCamera.pitch,
bearing: overviewMobileCamera.bearing,
edgeInsets: viewportPadding,
maxZoomLevel: overviewCameraOptions.maximumZoomLevel)
overviewCarPlayCamera.zoom = overviewCameraZoom(remainingCoordinatesOnRoute,
pitch: overviewCarPlayCamera.pitch,
bearing: overviewCarPlayCamera.bearing,
edgeInsets: carPlayCameraPadding,
maxZoomLevel: overviewCameraOptions.maximumZoomLevel)
}

if overviewCameraOptions.paddingUpdatesAllowed || overviewMobileCamera.padding == nil {
overviewMobileCamera.padding = viewportPadding
Expand Down Expand Up @@ -454,7 +461,23 @@ public class NavigationViewportDataSource: ViewportDataSource {
let mapViewBearing = Double(mapView?.cameraState.bearing ?? 0.0)
return mapViewBearing + bearing.shortestRotation(angle: mapViewBearing)
}


func overviewCameraZoom(_ coordinates: [CLLocationCoordinate2D],
pitch: CGFloat?,
bearing: CLLocationDirection?,
edgeInsets: UIEdgeInsets,
defaultZoomLevel: Double = 12.0,
maxZoomLevel: Double = 22.0,
minZoomLevel: Double = 2.0) -> CGFloat {
guard let mapView = mapView else { return CGFloat(defaultZoomLevel) }

let options = mapView.mapboxMap.camera(for: coordinates,
padding: edgeInsets,
bearing: 0,
pitch: 0)
return CGFloat(max(min(options.zoom ?? defaultZoomLevel, maxZoomLevel), minZoomLevel))
}

func zoom(_ coordinates: [CLLocationCoordinate2D],
pitch: Double = 0.0,
maxPitch: Double = 0.0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,67 +2,92 @@
"images" : [
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
"scale" : "3x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
"scale" : "3x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
"scale" : "3x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x60"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "60x60"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "1x"
"scale" : "1x",
"size" : "29x29"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "2x"
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "1x"
"scale" : "1x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "2x"
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "1x"
"scale" : "1x",
"size" : "76x76"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
"scale" : "2x",
"size" : "76x76"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "83.5x83.5"
},
{
"idiom" : "ios-marketing",
"scale" : "1x",
"size" : "1024x1024"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}

0 comments on commit 089eb78

Please sign in to comment.