From 111443c1a9603c419e6eece95fe53a5edd58b747 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Ferreira?= <60441552+JoaoFerreira-FrontEnd@users.noreply.github.com> Date: Fri, 21 Jun 2024 16:45:21 +0100 Subject: [PATCH] Make sure the current center is updated with the right coordinates when their calculated by the bounds. (#180) --- src/Providers/Maps/Leaflet/Features/Center.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Providers/Maps/Leaflet/Features/Center.ts b/src/Providers/Maps/Leaflet/Features/Center.ts index a3e635a..4e8dc79 100644 --- a/src/Providers/Maps/Leaflet/Features/Center.ts +++ b/src/Providers/Maps/Leaflet/Features/Center.ts @@ -53,7 +53,7 @@ namespace Provider.Maps.Leaflet.Feature { } public refreshCenter(value: OSFramework.Maps.OSStructures.OSMap.Coordinates, allowRefreshZoom: boolean): void { - const coordinates = new L.LatLng(value.lat as number, value.lng as number); + let coordinates = new L.LatLng(value.lat as number, value.lng as number); this._map.provider.setView(coordinates); if (allowRefreshZoom) { if (this._map.features.zoom.isAutofit) { @@ -63,6 +63,8 @@ namespace Provider.Maps.Leaflet.Feature { ) { this._map.provider.setView(coordinates); this._map.features.zoom.refreshZoom(); + const tempCenter = this._map.features.center.getCurrentCenter(); + coordinates = new L.LatLng(tempCenter.lat as number, tempCenter.lng as number); } else { this._map.provider.setView(coordinates, OSFramework.Maps.Helper.Constants.zoomAutofit); }