-
-
Notifications
You must be signed in to change notification settings - Fork 334
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow constraining camera to maximum bounds (#2475)
- Loading branch information
1 parent
f582327
commit 62b92e2
Showing
10 changed files
with
314 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
platform/ios/app-swift/Sources/MaximumScreenBoundsExample.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import MapLibre | ||
import SwiftUI | ||
import UIKit | ||
|
||
// Denver, Colorado | ||
private let center = CLLocationCoordinate2D(latitude: 39.748947, longitude: -104.995882) | ||
|
||
// Colorado’s bounds | ||
private let colorado = MLNCoordinateBounds( | ||
sw: CLLocationCoordinate2D(latitude: 36.986207, longitude: -109.049896), | ||
ne: CLLocationCoordinate2D(latitude: 40.989329, longitude: -102.062592) | ||
) | ||
|
||
struct MaximumScreenBoundsExample: UIViewRepresentable { | ||
func makeUIView(context _: Context) -> MLNMapView { | ||
let mapView = MLNMapView(frame: .zero, styleURL: VERSATILES_COLORFUL_STYLE) | ||
mapView.setCenter(center, zoomLevel: 10, direction: 0, animated: false) | ||
mapView.maximumScreenBounds = MLNCoordinateBounds(sw: colorado.sw, ne: colorado.ne) | ||
|
||
return mapView | ||
} | ||
|
||
func updateUIView(_: MLNMapView, context _: Context) {} | ||
|
||
func makeCoordinator() -> Coordinator { | ||
Coordinator() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.