Show/hide marker in account home js controller

This commit is contained in:
Anton Khorev 2024-06-27 03:26:35 +03:00
parent bd443cdfb1
commit aec885815e
2 changed files with 22 additions and 0 deletions

View file

@ -1,8 +1,28 @@
OSM.Home = function (map) {
let marker;
function clearMarker() {
if (marker) map.removeLayer(marker);
marker = null;
}
const page = {};
page.pushstate = page.popstate = page.load = function () {
map.setSidebarOverlaid(true);
clearMarker();
OSM.router.withoutMoveListener(function () {
map.setView(OSM.home, 15, { reset: true });
});
marker = L.marker(OSM.home, {
icon: OSM.getUserIcon(),
title: I18n.t("javascripts.home.marker_title")
}).addTo(map);
};
page.unload = function () {
clearMarker();
};
return page;

View file

@ -3316,6 +3316,8 @@ en:
show_address: Show address
query_features: Query features
centre_map: Centre map here
home:
marker_title: My home location
redactions:
edit:
heading: "Edit Redaction"