|
888 | 888 | { |
889 | 889 | if (mapEvent.Type == "ready") |
890 | 890 | { |
| 891 | + var cameraOptions = new CameraOptions |
| 892 | + { |
| 893 | + Bearing = (int?)Bearing, |
| 894 | + CenterOffset = CenterOffset, |
| 895 | + Duration = Duration, |
| 896 | + MaxZoom = MaxZoom, |
| 897 | + MinZoom = MinZoom, |
| 898 | + Pitch = Pitch, |
| 899 | + Type = CameryType?.ToString(), |
| 900 | + Bounds = Bounds, |
| 901 | + MaxBounds = Bounds != null ? MaxBounds : null, |
| 902 | + Offset = Bounds != null ? Offset : null, |
| 903 | + Padding = Bounds != null ? Padding : null, |
| 904 | + Center = Bounds == null ? Center : null, |
| 905 | + Zoom = Bounds == null ? Zoom : null |
| 906 | + }; |
891 | 907 | await JSRuntime.InvokeVoidAsync(Constants.JsConstants.MethodSetOptions.ToAzureMapsControlNamespace(), |
892 | | - new CameraOptions |
893 | | - { |
894 | | - Bearing = (int?)Bearing, |
895 | | - CenterOffset = CenterOffset, |
896 | | - Duration = Duration, |
897 | | - MaxZoom = MaxZoom, |
898 | | - MinZoom = MinZoom, |
899 | | - Pitch = Pitch, |
900 | | - Type = CameryType?.ToString(), |
901 | | - Bounds = Bounds, |
902 | | - MaxBounds = Bounds != null ? MaxBounds : null, |
903 | | - Offset = Bounds != null ? Offset : null, |
904 | | - Padding = Bounds != null ? Padding : null, |
905 | | - Center = Bounds == null ? Center : null, |
906 | | - Zoom = Bounds == null ? Zoom : null |
907 | | - }, |
| 908 | + cameraOptions, |
908 | 909 | new StyleOptions |
909 | 910 | { |
910 | 911 | AutoResize = AutoResize, |
|
956 | 957 | ClearHtmlMarkersAsync, |
957 | 958 | AddPopupAsync, |
958 | 959 | Popup_RemoveAsync, |
959 | | - ClearPopups) |
| 960 | + ClearPopupsAsync, |
| 961 | + SetCameraOptionsAsync) |
960 | 962 | { |
961 | 963 | Controls = Controls, |
962 | 964 | HtmlMarkers = HtmlMarkers, |
963 | | - DrawingToolbarOptions = DrawingToolbarOptions |
| 965 | + DrawingToolbarOptions = DrawingToolbarOptions, |
| 966 | + CameraOptions = cameraOptions |
964 | 967 | }); |
965 | 968 |
|
966 | 969 | await AddControlsAsync(Controls); |
|
970 | 973 | await DispatchMapEventAsync(mapEvent); |
971 | 974 | } |
972 | 975 |
|
| 976 | + private async Task SetCameraOptionsAsync(CameraOptions options) => await JSRuntime.InvokeVoidAsync(Constants.JsConstants.MethodSetCameraOptions.ToAzureMapsControlNamespace(), options); |
| 977 | + |
973 | 978 | private async Task ClearMapAsync() => await JSRuntime.InvokeVoidAsync(Constants.JsConstants.MethodClearMap.ToAzureMapsControlNamespace()); |
974 | 979 |
|
975 | 980 | private async Task DispatchMapEventAsync(MapJsEventArgs mapEvent) |
|
1140 | 1145 | MapService.Map.RemovePopup(id); |
1141 | 1146 | } |
1142 | 1147 | private async Task Popup_UpdateAsync(string id, AzureMapsControl.Components.Popups.PopupOptions options) => await JSRuntime.InvokeVoidAsync(Constants.JsConstants.MethodPopupUpdate.ToAzureMapsControlNamespace(), id, options); |
1143 | | - private async Task ClearPopups() => await JSRuntime.InvokeVoidAsync(Constants.JsConstants.MethodClearPopups.ToAzureMapsControlNamespace()); |
| 1148 | + private async Task ClearPopupsAsync() => await JSRuntime.InvokeVoidAsync(Constants.JsConstants.MethodClearPopups.ToAzureMapsControlNamespace()); |
1144 | 1149 |
|
1145 | 1150 | #endregion |
1146 | 1151 | } |
0 commit comments