Skip to content

Commit 9784353

Browse files
committed
Merge branch 'features/full-screen-control' into develop
2 parents 8e4b2ae + 6b6ec5e commit 9784353

76 files changed

Lines changed: 1676 additions & 195 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/controls/fullscreen/README.md

Lines changed: 47 additions & 0 deletions
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

Lines changed: 1 addition & 1 deletion
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

samples/AzureMapsControl.Sample/Pages/ControlsOnReady.razor renamed to samples/AzureMapsControl.Sample/Pages/Controls/ControlsOnReady.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@page "/ControlsOnReady"
1+
@page "/Controls/ControlsOnReady"
22

33
@using AzureMapsControl.Components.Map
44
<AzureMap Id="map"
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
@page "/Controls/FullScreen"
2+
3+
@inject AzureMapsControl.Components.FullScreen.IFullScreenService FullScreenService
4+
5+
@using AzureMapsControl.Components.Map
6+
<AzureMap Id="map"
7+
EventActivationFlags="AzureMapsControl.Components.Map.MapEventActivationFlags.None().Enable(MapEventType.Ready)"
8+
OnReady="OnMapReady"
9+
StyleOptions="new AzureMapsControl.Components.Map.StyleOptions { Style = AzureMapsControl.Components.Map.MapStyle.GrayscaleLight }"/>
10+
11+
@code {
12+
public async Task OnMapReady(MapEventArgs eventArgs)
13+
{
14+
if (await FullScreenService.IsSupportedAsync())
15+
{
16+
var fullScreenControl = new AzureMapsControl.Components.Controls.FullScreenControl(new Components.Controls.FullScreenControlOptions
17+
{
18+
Style = new Components.Atlas.Either<Components.Controls.ControlStyle, string>(Components.Controls.ControlStyle.Auto)
19+
},
20+
AzureMapsControl.Components.Controls.ControlPosition.TopRight,
21+
AzureMapsControl.Components.FullScreen.FullScreenEventActivationFlags.All());
22+
23+
fullScreenControl.OnFullScreenChanged += async isFullScreen => {
24+
if(isFullScreen)
25+
{
26+
await eventArgs.Map.SetStyleOptionsAsync(options => options.Style = MapStyle.GrayscaleDark);
27+
}
28+
else
29+
{
30+
await eventArgs.Map.SetStyleOptionsAsync(options => options.Style = MapStyle.GrayscaleLight);
31+
}
32+
};
33+
34+
await eventArgs.Map.AddControlsAsync(fullScreenControl);
35+
}
36+
}
37+
}

samples/AzureMapsControl.Sample/Pages/GeolocationControl.razor renamed to samples/AzureMapsControl.Sample/Pages/Controls/GeolocationControl.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@page "/GeolocationControl"
1+
@page "/Controls/GeolocationControl"
22
@inject AzureMapsControl.Components.Geolocation.IGeolocationService GeolocationService
33

44
@using AzureMapsControl.Components.Map

samples/AzureMapsControl.Sample/Pages/Controls.razor renamed to samples/AzureMapsControl.Sample/Pages/Controls/Index.razor

File renamed without changes.

samples/AzureMapsControl.Sample/Pages/OverviewMap.razor renamed to samples/AzureMapsControl.Sample/Pages/Controls/OverviewMap.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@page "/OverviewMap"
1+
@page "/Controls/OverviewMap"
22

33
@using AzureMapsControl.Components.Map
44
<AzureMap Id="map"

samples/AzureMapsControl.Sample/Pages/Scalebar.razor renamed to samples/AzureMapsControl.Sample/Pages/Controls/Scalebar.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@page "/Scalebar"
1+
@page "/Controls/Scalebar"
22

33
@using AzureMapsControl.Components.Map
44
<AzureMap Id="map"

samples/AzureMapsControl.Sample/Pages/DrawingToolbar.razor renamed to samples/AzureMapsControl.Sample/Pages/Drawing/DrawingToolbar.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@page "/DrawingToolbar"
1+
@page "/Drawing/DrawingToolbar"
22

33
@using AzureMapsControl.Components.Map
44
<AzureMap Id="map" DrawingToolbarOptions="new Components.Drawing.DrawingToolbarOptions

samples/AzureMapsControl.Sample/Pages/DrawingToolbarOnReady.razor renamed to samples/AzureMapsControl.Sample/Pages/Drawing/DrawingToolbarOnReady.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@page "/DrawingToolbarOnReady"
1+
@page "/Drawing/DrawingToolbarOnReady"
22

33
@using AzureMapsControl.Components.Map
44
<AzureMap Id="map"

0 commit comments

Comments
 (0)