Skip to content

Commit 6b6ec5e

Browse files
committed
Add FullScreenControl documentation
1 parent d290657 commit 6b6ec5e

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

docs/controls/fullscreen/README.md

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
## Fullscreen Control
2+
3+
The `FullScreen` control is not part of the `atlas` library, so you need to include the js file of the control into your application and reference it with a `script` tag on your razor page. It can be found on the [GitHub repository of the fullscreen control](https://github.com/Azure-Samples/azure-maps-fullscreen-control).
4+
5+
Before adding the control, you might want to check if the browser supports the fullscreen mode. You can inject an instance of `IFullScreenService` on your pages and call its `IsSupportedAsync` method to do so.
6+
7+
You can also react to the `OnFullScreenChanged` event on this control. This event exposes a boolean representating the current state (`true` if the container is in full screen mode, otherwise `false`).
8+
9+
```
10+
@page "/Controls/FullScreen"
11+
12+
@inject AzureMapsControl.Components.FullScreen.IFullScreenService FullScreenService
13+
14+
@using AzureMapsControl.Components.Map
15+
<AzureMap Id="map"
16+
EventActivationFlags="AzureMapsControl.Components.Map.MapEventActivationFlags.None().Enable(MapEventType.Ready)"
17+
OnReady="OnMapReady"
18+
StyleOptions="new AzureMapsControl.Components.Map.StyleOptions { Style = AzureMapsControl.Components.Map.MapStyle.GrayscaleLight }"/>
19+
20+
@code {
21+
public async Task OnMapReady(MapEventArgs eventArgs)
22+
{
23+
if (await FullScreenService.IsSupportedAsync())
24+
{
25+
var fullScreenControl = new AzureMapsControl.Components.Controls.FullScreenControl(new Components.Controls.FullScreenControlOptions
26+
{
27+
Style = new Components.Atlas.Either<Components.Controls.ControlStyle, string>(Components.Controls.ControlStyle.Auto)
28+
},
29+
AzureMapsControl.Components.Controls.ControlPosition.TopRight,
30+
AzureMapsControl.Components.FullScreen.FullScreenEventActivationFlags.All());
31+
32+
fullScreenControl.OnFullScreenChanged += async isFullScreen => {
33+
if(isFullScreen)
34+
{
35+
await eventArgs.Map.SetStyleOptionsAsync(options => options.Style = MapStyle.GrayscaleDark);
36+
}
37+
else
38+
{
39+
await eventArgs.Map.SetStyleOptionsAsync(options => options.Style = MapStyle.GrayscaleLight);
40+
}
41+
};
42+
43+
await eventArgs.Map.AddControlsAsync(fullScreenControl);
44+
}
45+
}
46+
}
47+
```

docs/controls/geolocation/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
The `Geolocation` control is not part of the `atlas` library, so you need to include the js file of the control into your application and reference it with a `script` tag on your razor page. It can be found on the [GitHub repository of the geolocation control](https://github.com/Azure-Samples/azure-maps-geolocation-control).
44

5-
Before adding the control, you might want to check if the browser supports the geolocation. You can inject an instance of `IGeolocationService` on your pages and call its `IsGeolocationSupportedAsync method` to do so.
5+
Before adding the control, you might want to check if the browser supports the geolocation. You can inject an instance of `IGeolocationService` on your pages and call its `IsGeolocationSupportedAsync` method to do so.
66

77
You can also react to two events on this control :
88

0 commit comments

Comments
 (0)