From: Tom Hughes Date: Sun, 16 Feb 2025 11:12:47 +0000 (+0000) Subject: Merge remote-tracking branch 'upstream/pull/5686' X-Git-Tag: live~306 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/a5ee93b30110e2c89879e0a67ab2b1c18158faf2?hp=d90f353e5f30c35fdfc61a462fdb39b3504998ce Merge remote-tracking branch 'upstream/pull/5686' --- diff --git a/app/assets/javascripts/index/note.js b/app/assets/javascripts/index/note.js index 6a0487aaa..4fb512bdd 100644 --- a/app/assets/javascripts/index/note.js +++ b/app/assets/javascripts/index/note.js @@ -22,16 +22,10 @@ OSM.Note = function (map) { page.pushstate = page.popstate = function (path, id) { OSM.loadSidebarContent(path, function () { - initialize(path, id); - var data = $(".details").data(); if (!data) return; var latLng = L.latLng(data.coordinates.split(",")); - if (!map.getBounds().contains(latLng)) { - OSM.router.withoutMoveListener(function () { - map.setView(latLng, 15, { reset: true }); - }); - } + initialize(path, id, map.getBounds().contains(latLng)); }); }; @@ -39,7 +33,7 @@ OSM.Note = function (map) { initialize(path, id); }; - function initialize(path, id) { + function initialize(path, id, skipMoveToNote) { content.find("button[name]").on("click", function (e) { e.preventDefault(); var data = $(e.target).data(); @@ -50,7 +44,7 @@ OSM.Note = function (map) { oauth: true, success: () => { OSM.loadSidebarContent(path, () => { - initialize(path, id); + initialize(path, id, false); }); }, error: (xhr) => { @@ -86,7 +80,7 @@ OSM.Note = function (map) { latLng: L.latLng(data.coordinates.split(",")), icon: noteIcons[data.status] }, function () { - if (!hashParams.center) { + if (!hashParams.center && !skipMoveToNote) { var latLng = L.latLng(data.coordinates.split(",")); OSM.router.withoutMoveListener(function () { map.setView(latLng, 15, { reset: true });