Skip to content

Commit

Permalink
Make sure the current center is updated with the right coordinates wh…
Browse files Browse the repository at this point in the history
…en their calculated by the bounds. (#180)
  • Loading branch information
JoaoFerreira-FrontEnd authored Jun 21, 2024
1 parent 877864b commit 111443c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Providers/Maps/Leaflet/Features/Center.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
}
Expand Down

0 comments on commit 111443c

Please sign in to comment.