From bdb416ac113268605cd276578114ea2ebe9d12d6 Mon Sep 17 00:00:00 2001 From: j Date: Fri, 21 Jul 2023 11:20:41 +0100 Subject: [PATCH] fix places spanning the Antimeridian --- source/UI/js/Map/LeafletMapPlace.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/source/UI/js/Map/LeafletMapPlace.js b/source/UI/js/Map/LeafletMapPlace.js index e7cdd7bc..a413afa8 100644 --- a/source/UI/js/Map/LeafletMapPlace.js +++ b/source/UI/js/Map/LeafletMapPlace.js @@ -45,11 +45,21 @@ Ox.LeafletMapPlace = function(options) { function update(updateMarker) { // console.log('foo', that.north, that.east, that.south, that.west); + if (that.east < that.west) { + if (that.west > 170) { + that.west -= 360 + //console.log(that.geoname, '<< west', that.west+360, '=>', that.west) + } else { + that.east += 360 + //console.log(that.geoname, '>> east', that.east-360, that.east) + } + } that.points = { ne: new L.LatLng(that.north, that.east), sw: new L.LatLng(that.south, that.west) }; console.log('points', JSON.stringify(that.points, null, 2)); + that.bounds = new L.latLngBounds(that.points.sw, that.points.ne); that.center = that.bounds.getCenter(); that.lat = that.center.lat;