From 6f40dbb542d6d890a3ca360b78e5ae5e6dfaf4da Mon Sep 17 00:00:00 2001 From: Bernard Darnton Date: Mon, 23 Nov 2020 21:00:41 +1300 Subject: [PATCH] Update to Leaflet 0.1.12. --- BlazorDeviceTestRig/BlazorDeviceTestRig.csproj | 16 +++++++--------- BlazorDeviceTestRig/Pages/Geolocation.razor | 4 ++-- BlazorDeviceTestRig/Pages/Geolocation.razor.cs | 18 +++++++++++------- BlazorDeviceTestRig/wwwroot/index.html | 2 -- .../Darnton.Blazor.DeviceInterop.csproj | 15 +++++++-------- 5 files changed, 27 insertions(+), 28 deletions(-) diff --git a/BlazorDeviceTestRig/BlazorDeviceTestRig.csproj b/BlazorDeviceTestRig/BlazorDeviceTestRig.csproj index 048f3f9..6841981 100644 --- a/BlazorDeviceTestRig/BlazorDeviceTestRig.csproj +++ b/BlazorDeviceTestRig/BlazorDeviceTestRig.csproj @@ -1,17 +1,15 @@ - + - netstandard2.1 - 3.0 + net5.0 - - - - - - + + + + + diff --git a/BlazorDeviceTestRig/Pages/Geolocation.razor b/BlazorDeviceTestRig/Pages/Geolocation.razor index d547322..cd4e799 100644 --- a/BlazorDeviceTestRig/Pages/Geolocation.razor +++ b/BlazorDeviceTestRig/Pages/Geolocation.razor @@ -20,7 +20,7 @@ {

Error: @CurrentPositionResult.Error.Message

} - +
@@ -38,5 +38,5 @@

Watch handler id: @WatchHandlerId - +
\ No newline at end of file diff --git a/BlazorDeviceTestRig/Pages/Geolocation.razor.cs b/BlazorDeviceTestRig/Pages/Geolocation.razor.cs index 1d7268a..aadefa6 100644 --- a/BlazorDeviceTestRig/Pages/Geolocation.razor.cs +++ b/BlazorDeviceTestRig/Pages/Geolocation.razor.cs @@ -2,7 +2,6 @@ using Darnton.Blazor.DeviceInterop.Geolocation; using BlazorDeviceTestRig.Geolocation; using Microsoft.AspNetCore.Components; -using Microsoft.JSInterop; using System; using System.Collections.Generic; using System.Linq; @@ -12,14 +11,14 @@ namespace BlazorDeviceTestRig.Pages { public class GeolocationBase : ComponentBase, IDisposable { - [Inject] public IJSRuntime JSRuntime { get; set; } [Inject] public IGeolocationService GeolocationService { get; set; } protected Map PositionMap; - protected TileLayer OpenStreetMapsTileLayer; + protected TileLayer PositionTileLayer; protected Marker CurrentPositionMarker; protected Map WatchMap; + protected TileLayer WatchTileLayer; protected Polyline WatchPath; protected List WatchMarkers; @@ -43,12 +42,20 @@ namespace BlazorDeviceTestRig.Pages Center = new LatLng(-42, 175), Zoom = 4 }); + PositionTileLayer = new TileLayer( + "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", + new TileLayerOptions + { + Attribution = @"Map data © OpenStreetMap contributors, " + + @"CC-BY-SA" + } + ); WatchMap = new Map("geolocationWatchMap", new MapOptions //Centred on New Zealand { Center = new LatLng(-42, 175), Zoom = 4 }); - OpenStreetMapsTileLayer = new TileLayer( + WatchTileLayer = new TileLayer( "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", new TileLayerOptions { @@ -70,7 +77,6 @@ namespace BlazorDeviceTestRig.Pages CurrentPositionMarker = new Marker( CurrentPositionResult.Position.ToLeafletLatLng(), null ); - await CurrentPositionMarker.BindToJsRuntime(JSRuntime); await CurrentPositionMarker.AddTo(PositionMap); } StateHasChanged(); @@ -115,7 +121,6 @@ namespace BlazorDeviceTestRig.Pages { WatchMarkers = new List { marker }; WatchPath = new Polyline(WatchMarkers.Select(m => m.LatLng), new PolylineOptions()); - await WatchPath.BindToJsRuntime(JSRuntime); await WatchPath.AddTo(WatchMap); } else @@ -123,7 +128,6 @@ namespace BlazorDeviceTestRig.Pages WatchMarkers.Add(marker); await WatchPath.AddLatLng(latlng); } - await marker.BindToJsRuntime(JSRuntime); await marker.AddTo(WatchMap); } StateHasChanged(); diff --git a/BlazorDeviceTestRig/wwwroot/index.html b/BlazorDeviceTestRig/wwwroot/index.html index e9c8b46..9977cf7 100644 --- a/BlazorDeviceTestRig/wwwroot/index.html +++ b/BlazorDeviceTestRig/wwwroot/index.html @@ -27,8 +27,6 @@ - - diff --git a/Darnton.Blazor.DeviceInterop/Darnton.Blazor.DeviceInterop.csproj b/Darnton.Blazor.DeviceInterop/Darnton.Blazor.DeviceInterop.csproj index c10ebd5..89272ab 100644 --- a/Darnton.Blazor.DeviceInterop/Darnton.Blazor.DeviceInterop.csproj +++ b/Darnton.Blazor.DeviceInterop/Darnton.Blazor.DeviceInterop.csproj @@ -1,19 +1,18 @@  - netstandard2.0 - 3.0 + net5.0 Darnton.Blazor.DeviceInterop true - 0.1.0 + 0.1.1 Bernard Darnton Blazor device interop library - Blazor device interop library including wrappers for Geolocation API + Blazor device interop library including wrappers for Geolocation API. Updated to .NET 5 2020 Bernard Darnton MIT https://github.com/darnton/BlazorDeviceInterop - 0.0.1.0 - 0.0.1.0 + 0.0.1.1 + 0.0.1.1 @@ -23,8 +22,8 @@ - - + +