mirror of
https://github.com/farcasclaudiu/BlazorDeviceInterop.git
synced 2026-06-22 07:01:03 +03:00
Update to Leaflet 0.1.12.
This commit is contained in:
@@ -1,17 +1,15 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netstandard2.1</TargetFramework>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
<RazorLangVersion>3.0</RazorLangVersion>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Darnton.Blazor.Leaflet" Version="0.1.0" />
|
<PackageReference Include="Darnton.Blazor.Leaflet" Version="0.1.2" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components" Version="3.1.8" />
|
<PackageReference Include="Microsoft.AspNetCore.Components" Version="5.0.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="3.2.1" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="5.0.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Build" Version="3.2.1" PrivateAssets="all" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="5.0.0" PrivateAssets="all" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="3.2.1" PrivateAssets="all" />
|
<PackageReference Include="System.Net.Http.Json" Version="5.0.0" />
|
||||||
<PackageReference Include="System.Net.Http.Json" Version="3.2.1" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
{
|
{
|
||||||
<p class="bg-light text-danger">Error: @CurrentPositionResult.Error.Message</p>
|
<p class="bg-light text-danger">Error: @CurrentPositionResult.Error.Message</p>
|
||||||
}
|
}
|
||||||
<LeafletMap Map="PositionMap" TileLayer="OpenStreetMapsTileLayer" />
|
<LeafletMap Map="PositionMap" TileLayer="PositionTileLayer" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="my-3">
|
<div class="my-3">
|
||||||
@@ -38,5 +38,5 @@
|
|||||||
</p>
|
</p>
|
||||||
<button class="btn btn-primary my-3" @onclick="TogglePositionWatch">@ToggleWatchCommand</button>
|
<button class="btn btn-primary my-3" @onclick="TogglePositionWatch">@ToggleWatchCommand</button>
|
||||||
Watch handler id: @WatchHandlerId
|
Watch handler id: @WatchHandlerId
|
||||||
<LeafletMap Map="WatchMap" TileLayer="OpenStreetMapsTileLayer" />
|
<LeafletMap Map="WatchMap" TileLayer="WatchTileLayer" />
|
||||||
</div>
|
</div>
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
using Darnton.Blazor.DeviceInterop.Geolocation;
|
using Darnton.Blazor.DeviceInterop.Geolocation;
|
||||||
using BlazorDeviceTestRig.Geolocation;
|
using BlazorDeviceTestRig.Geolocation;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
using Microsoft.JSInterop;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -12,14 +11,14 @@ namespace BlazorDeviceTestRig.Pages
|
|||||||
{
|
{
|
||||||
public class GeolocationBase : ComponentBase, IDisposable
|
public class GeolocationBase : ComponentBase, IDisposable
|
||||||
{
|
{
|
||||||
[Inject] public IJSRuntime JSRuntime { get; set; }
|
|
||||||
[Inject] public IGeolocationService GeolocationService { get; set; }
|
[Inject] public IGeolocationService GeolocationService { get; set; }
|
||||||
|
|
||||||
protected Map PositionMap;
|
protected Map PositionMap;
|
||||||
protected TileLayer OpenStreetMapsTileLayer;
|
protected TileLayer PositionTileLayer;
|
||||||
protected Marker CurrentPositionMarker;
|
protected Marker CurrentPositionMarker;
|
||||||
|
|
||||||
protected Map WatchMap;
|
protected Map WatchMap;
|
||||||
|
protected TileLayer WatchTileLayer;
|
||||||
protected Polyline WatchPath;
|
protected Polyline WatchPath;
|
||||||
protected List<Marker> WatchMarkers;
|
protected List<Marker> WatchMarkers;
|
||||||
|
|
||||||
@@ -43,12 +42,20 @@ namespace BlazorDeviceTestRig.Pages
|
|||||||
Center = new LatLng(-42, 175),
|
Center = new LatLng(-42, 175),
|
||||||
Zoom = 4
|
Zoom = 4
|
||||||
});
|
});
|
||||||
|
PositionTileLayer = new TileLayer(
|
||||||
|
"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
||||||
|
new TileLayerOptions
|
||||||
|
{
|
||||||
|
Attribution = @"Map data © <a href=""https://www.openstreetmap.org/"">OpenStreetMap</a> contributors, " +
|
||||||
|
@"<a href=""https://creativecommons.org/licenses/by-sa/2.0/"">CC-BY-SA</a>"
|
||||||
|
}
|
||||||
|
);
|
||||||
WatchMap = new Map("geolocationWatchMap", new MapOptions //Centred on New Zealand
|
WatchMap = new Map("geolocationWatchMap", new MapOptions //Centred on New Zealand
|
||||||
{
|
{
|
||||||
Center = new LatLng(-42, 175),
|
Center = new LatLng(-42, 175),
|
||||||
Zoom = 4
|
Zoom = 4
|
||||||
});
|
});
|
||||||
OpenStreetMapsTileLayer = new TileLayer(
|
WatchTileLayer = new TileLayer(
|
||||||
"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
||||||
new TileLayerOptions
|
new TileLayerOptions
|
||||||
{
|
{
|
||||||
@@ -70,7 +77,6 @@ namespace BlazorDeviceTestRig.Pages
|
|||||||
CurrentPositionMarker = new Marker(
|
CurrentPositionMarker = new Marker(
|
||||||
CurrentPositionResult.Position.ToLeafletLatLng(), null
|
CurrentPositionResult.Position.ToLeafletLatLng(), null
|
||||||
);
|
);
|
||||||
await CurrentPositionMarker.BindToJsRuntime(JSRuntime);
|
|
||||||
await CurrentPositionMarker.AddTo(PositionMap);
|
await CurrentPositionMarker.AddTo(PositionMap);
|
||||||
}
|
}
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
@@ -115,7 +121,6 @@ namespace BlazorDeviceTestRig.Pages
|
|||||||
{
|
{
|
||||||
WatchMarkers = new List<Marker> { marker };
|
WatchMarkers = new List<Marker> { marker };
|
||||||
WatchPath = new Polyline(WatchMarkers.Select(m => m.LatLng), new PolylineOptions());
|
WatchPath = new Polyline(WatchMarkers.Select(m => m.LatLng), new PolylineOptions());
|
||||||
await WatchPath.BindToJsRuntime(JSRuntime);
|
|
||||||
await WatchPath.AddTo(WatchMap);
|
await WatchPath.AddTo(WatchMap);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -123,7 +128,6 @@ namespace BlazorDeviceTestRig.Pages
|
|||||||
WatchMarkers.Add(marker);
|
WatchMarkers.Add(marker);
|
||||||
await WatchPath.AddLatLng(latlng);
|
await WatchPath.AddLatLng(latlng);
|
||||||
}
|
}
|
||||||
await marker.BindToJsRuntime(JSRuntime);
|
|
||||||
await marker.AddTo(WatchMap);
|
await marker.AddTo(WatchMap);
|
||||||
}
|
}
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
|
|||||||
@@ -27,8 +27,6 @@
|
|||||||
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"
|
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"
|
||||||
integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
|
integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
|
||||||
crossorigin=""></script>
|
crossorigin=""></script>
|
||||||
<script src="_content/Darnton.Blazor.Leaflet/device-interop.js"></script>
|
|
||||||
<script src="_content/Darnton.Blazor.Leaflet/leaflet-map/leaflet-map.js"></script>
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,19 +1,18 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
<RazorLangVersion>3.0</RazorLangVersion>
|
|
||||||
<RootNamespace>Darnton.Blazor.DeviceInterop</RootNamespace>
|
<RootNamespace>Darnton.Blazor.DeviceInterop</RootNamespace>
|
||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
<Version>0.1.0</Version>
|
<Version>0.1.1</Version>
|
||||||
<Authors>Bernard Darnton</Authors>
|
<Authors>Bernard Darnton</Authors>
|
||||||
<Product>Blazor device interop library</Product>
|
<Product>Blazor device interop library</Product>
|
||||||
<Description>Blazor device interop library including wrappers for Geolocation API</Description>
|
<Description>Blazor device interop library including wrappers for Geolocation API. Updated to .NET 5</Description>
|
||||||
<Copyright>2020 Bernard Darnton</Copyright>
|
<Copyright>2020 Bernard Darnton</Copyright>
|
||||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||||
<RepositoryUrl>https://github.com/darnton/BlazorDeviceInterop</RepositoryUrl>
|
<RepositoryUrl>https://github.com/darnton/BlazorDeviceInterop</RepositoryUrl>
|
||||||
<AssemblyVersion>0.0.1.0</AssemblyVersion>
|
<AssemblyVersion>0.0.1.1</AssemblyVersion>
|
||||||
<FileVersion>0.0.1.0</FileVersion>
|
<FileVersion>0.0.1.1</FileVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
@@ -23,8 +22,8 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Darnton.Units" Version="0.1.1" />
|
<PackageReference Include="Darnton.Units" Version="0.1.1" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components" Version="3.1.8" />
|
<PackageReference Include="Microsoft.AspNetCore.Components" Version="5.0.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="3.1.8" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="5.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
Reference in New Issue
Block a user