From: Radek Czajka Date: Sat, 1 May 2021 22:36:53 +0000 (+0200) Subject: To get from Yokohama to San Francisco, keep going east. X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/131d04d7a357f3d1c7f77f8f4931a96caee04d53 To get from Yokohama to San Francisco, keep going east. --- diff --git a/src/wolnelektury/static/js/book_text/references.js b/src/wolnelektury/static/js/book_text/references.js index b75a4daf3..b9fc40f86 100644 --- a/src/wolnelektury/static/js/book_text/references.js +++ b/src/wolnelektury/static/js/book_text/references.js @@ -59,10 +59,18 @@ if (ref.location) { enable_map(); - marker.setLatLng(ref.location); + let newLoc = [ + ref.location[0], + ref.location[1] + Math.round( + (map.getCenter().lng - ref.location[1]) / 360 + ) * 360 + ]; + + marker.setLatLng(newLoc); marker.bindTooltip(ref.label).openTooltip(); map.addLayer(marker); - map.panTo(ref.location, { + + map.panTo(newLoc, { animate: true, duration: 1, });