Skip to content

Commit 10d8004

Browse files
committed
- check and fix iOS binding
1 parent 8004443 commit 10d8004

File tree

4 files changed

+29
-11
lines changed

4 files changed

+29
-11
lines changed

src/libs/Mapbox.Maui/IMapboxView.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,14 @@ public interface IMapboxController
8787
CoordinateBounds GetCoordinateBoundsForCamera(CameraOptions cameraOptions);
8888
ScreenPosition GetScreenPosition(IPosition position);
8989
CameraOptions? CameraForCoordinates(
90-
IEnumerable<MapPosition> coordinates,
90+
IEnumerable<IPosition> coordinates,
9191
CameraOptions? cameraOptions = default,
9292
Thickness? coordinatesPadding = default,
9393
double? maxZoom = default,
9494
ScreenPosition? offset = default
9595
);
9696
void CameraForCoordinates(
97-
IEnumerable<MapPosition> coordinates,
97+
IEnumerable<IPosition> coordinates,
9898
Action<CameraOptions?> completion,
9999
CameraOptions? cameraOptions = default,
100100
Thickness? coordinatesPadding = default,

src/libs/Mapbox.Maui/Platforms/Android/MapboxViewHandler.Controller.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public ScreenPosition GetScreenPosition(IPosition position)
5959
* Also empty [CameraOptions] are returned in case of an internal error.
6060
*/
6161
public CameraOptions? CameraForCoordinates(
62-
IEnumerable<MapPosition> coordinates,
62+
IEnumerable<IPosition> coordinates,
6363
CameraOptions? cameraOptions = null,
6464
Thickness? coordinatesPadding = null,
6565
double? maxZoom = null,
@@ -71,7 +71,7 @@ public ScreenPosition GetScreenPosition(IPosition position)
7171

7272
var result = mapView.MapboxMap.CameraForCoordinates(
7373
coordinates?.Select(x => x.ToGeoPoint()).ToList(),
74-
cameraOptions?.ToNative(),
74+
(cameraOptions?? new()).ToNative(),
7575
coordinatesPadding?.ToNative(),
7676
maxZoom?.ToNative(),
7777
offset?.ToScreenCoordinate()
@@ -91,7 +91,7 @@ public ScreenPosition GetScreenPosition(IPosition position)
9191
* @param completion Callback returning the [CameraOptions] object representing the provided parameters. Those [CameraOptions] always take into account actual MapView size and may return empty ([CameraOptions.isEmpty]) options only if an internal error has occurred.
9292
*/
9393
public void CameraForCoordinates(
94-
IEnumerable<MapPosition> coordinates,
94+
IEnumerable<IPosition> coordinates,
9595
Action<CameraOptions?> completion,
9696
CameraOptions? cameraOptions = null,
9797
Thickness? coordinatesPadding = null,
@@ -108,7 +108,7 @@ public void CameraForCoordinates(
108108

109109
mapView.MapboxMap.CameraForCoordinates(
110110
coordinates?.Select(x => x.ToGeoPoint()).ToList(),
111-
cameraOptions?.ToNative(),
111+
(cameraOptions??new()).ToNative(),
112112
coordinatesPadding?.ToNative(),
113113
maxZoom?.ToNative(),
114114
offset?.ToScreenCoordinate(),

src/libs/Mapbox.Maui/Platforms/iOS/MapboxViewHandler.Controller.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public ScreenPosition GetScreenPosition(IPosition position)
6060
* Also empty [CameraOptions] are returned in case of an internal error.
6161
*/
6262
public CameraOptions? CameraForCoordinates(
63-
IEnumerable<MapPosition> coordinates,
63+
IEnumerable<IPosition> coordinates,
6464
CameraOptions? cameraOptions = null,
6565
Thickness? coordinatesPadding = null,
6666
double? maxZoom = null,
@@ -73,7 +73,7 @@ public ScreenPosition GetScreenPosition(IPosition position)
7373
TMBCameraOptions? xresult = null;
7474
mapView.MapboxMap().CameraFor(
7575
coordinates?.Select(x => x.ToNSValue()).ToArray(),
76-
cameraOptions?.ToNative(),
76+
(cameraOptions?? new()).ToNative(),
7777
coordinatesPadding?.ToNSValue(),
7878
maxZoom?.ToNSNumber(),
7979
offset?.ToNSValue(),
@@ -96,7 +96,7 @@ public ScreenPosition GetScreenPosition(IPosition position)
9696
* @param completion Callback returning the [CameraOptions] object representing the provided parameters. Those [CameraOptions] always take into account actual MapView size and may return empty ([CameraOptions.isEmpty]) options only if an internal error has occurred.
9797
*/
9898
public void CameraForCoordinates(
99-
IEnumerable<MapPosition> coordinates,
99+
IEnumerable<IPosition> coordinates,
100100
Action<CameraOptions?> completion,
101101
CameraOptions? cameraOptions = null,
102102
Thickness? coordinatesPadding = null,
@@ -114,7 +114,7 @@ public void CameraForCoordinates(
114114

115115
mapView.MapboxMap().CameraFor(
116116
coordinates?.Select(x => x.ToNSValue()).ToArray(),
117-
cameraOptions?.ToNative(),
117+
(cameraOptions?? new()).ToNative(),
118118
coordinatesPadding?.ToNSValue(),
119119
maxZoom?.ToNSNumber(),
120120
offset?.ToNSValue(),

src/qs/MapboxMauiQs/Examples/Lab/70.BasicLocationPulsingCircle/BasicLocationPulsingCircleExample.cs

+19-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using MapboxMaui;
2+
13
namespace MapboxMauiQs;
24

35
public class BasicLocationPulsingCircleExample : ContentPage, IExamplePage, IQueryAttributable
@@ -33,7 +35,8 @@ private async void OpenSettings(object obj)
3335
? "Hide user location" : "Show user location",
3436
map.LocationComponent.PulsingEnabled
3537
? "Hide pulsing" : "Show pulsing",
36-
"Show accuracy ring"
38+
"Show accuracy ring",
39+
"Change map style"
3740
);
3841

3942
switch (action) {
@@ -48,6 +51,9 @@ private async void OpenSettings(object obj)
4851
case "Show accuracy ring":
4952
ShowPulsingAccuracyRing(action);
5053
break;
54+
case "Change map style":
55+
ToggleMapboxStyle(action);
56+
break;
5157
}
5258
}
5359

@@ -118,5 +124,17 @@ private void Map_IndicatorPositionChanged(object sender, IndicatorPositionChange
118124
{
119125
FocalPoint = map.MapboxController.GetScreenPosition(e.Position),
120126
};
127+
128+
// var bounds = map.MapboxController.GetCoordinateBoundsForCamera(map.CameraController.CameraState);
129+
// IEnumerable<IPosition> coords = new IPosition[] {
130+
// bounds.Southwest.ToPoint().Coordinates,
131+
// bounds.Northeast.ToPoint().Coordinates
132+
// };
133+
// map.MapboxController.CameraForCoordinates(
134+
// coords
135+
// , completion: (x) =>
136+
// {
137+
138+
// });
121139
}
122140
}

0 commit comments

Comments
 (0)