Show/hide marker in account home js controller
This commit is contained in:
parent
bd443cdfb1
commit
aec885815e
2 changed files with 22 additions and 0 deletions
|
@ -1,8 +1,28 @@
|
||||||
OSM.Home = function (map) {
|
OSM.Home = function (map) {
|
||||||
|
let marker;
|
||||||
|
|
||||||
|
function clearMarker() {
|
||||||
|
if (marker) map.removeLayer(marker);
|
||||||
|
marker = null;
|
||||||
|
}
|
||||||
|
|
||||||
const page = {};
|
const page = {};
|
||||||
|
|
||||||
page.pushstate = page.popstate = page.load = function () {
|
page.pushstate = page.popstate = page.load = function () {
|
||||||
map.setSidebarOverlaid(true);
|
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;
|
return page;
|
||||||
|
|
|
@ -3316,6 +3316,8 @@ en:
|
||||||
show_address: Show address
|
show_address: Show address
|
||||||
query_features: Query features
|
query_features: Query features
|
||||||
centre_map: Centre map here
|
centre_map: Centre map here
|
||||||
|
home:
|
||||||
|
marker_title: My home location
|
||||||
redactions:
|
redactions:
|
||||||
edit:
|
edit:
|
||||||
heading: "Edit Redaction"
|
heading: "Edit Redaction"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue