You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Convenience method that returns the [CameraOptions] object for given parameters.
48
+
*
49
+
* Note: if the render thread did not yet calculate the size of the map (due to initialization or map resizing) - empty [CameraOptions] will be returned.
50
+
* Emptiness could be checked with [CameraOptions.isEmpty]. Consider using asynchronous overloaded method.
51
+
*
52
+
* @param coordinates The `coordinates` representing the bounds of the camera.
53
+
* @param camera The [CameraOptions] which will be applied before calculating the camera for the coordinates. If any of the fields in [CameraOptions] are not provided then the current value from the map for that field will be used.
54
+
* @param coordinatesPadding The amount of padding in pixels to add to the given `coordinates`.
55
+
* Note: This padding is not applied to the map but to the coordinates provided. If you want to apply padding to the map use param `camera`.
56
+
* @param maxZoom The maximum zoom level allowed in the returned camera options.
57
+
* @param offset The center of the given bounds relative to map center in pixels.
58
+
*
59
+
* @return The [CameraOptions] object representing the provided parameters if the map size was calculated and empty [CameraOptions] otherwise, see [CameraOptions.isEmpty].
60
+
* Also empty [CameraOptions] are returned in case of an internal error.
61
+
*/
62
+
publicCameraOptions?CameraForCoordinates(
63
+
IEnumerable<MapPosition>coordinates,
64
+
CameraOptions?cameraOptions=null,
65
+
Thickness?coordinatesPadding=null,
66
+
double?maxZoom=null,
67
+
ScreenPosition?offset=null)
68
+
{
69
+
varmapView=PlatformView.MapView;
70
+
71
+
if(mapView==null)returndefault;
72
+
73
+
TMBCameraOptions?xresult=null;
74
+
mapView.MapboxMap().CameraFor(
75
+
coordinates?.Select(x =>x.ToNSValue()).ToArray(),
76
+
cameraOptions?.ToNative(),
77
+
coordinatesPadding?.ToNSValue(),
78
+
maxZoom?.ToNSNumber(),
79
+
offset?.ToNSValue(),
80
+
(result,_)=>
81
+
{
82
+
xresult=result;
83
+
});
84
+
returnxresult?.ToX();
85
+
}
86
+
87
+
/**
88
+
* Convenience method that returns the [CameraOptions] object for given parameters.
89
+
*
90
+
* @param coordinates The `coordinates` representing the bounds of the camera.
91
+
* @param camera The [CameraOptions] which will be applied before calculating the camera for the coordinates. If any of the fields in [CameraOptions] are not provided then the current value from the map for that field will be used.
92
+
* @param coordinatesPadding The amount of padding in pixels to add to the given `coordinates`.
93
+
* Note: This padding is not applied to the map but to the coordinates provided. If you want to apply padding to the map use param `camera`.
94
+
* @param maxZoom The maximum zoom level allowed in the returned camera options.
95
+
* @param offset The center of the given bounds relative to map center in pixels.
96
+
* @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.
0 commit comments