Skip to content

Commit

Permalink
share imports landmark
Browse files Browse the repository at this point in the history
  • Loading branch information
azarz committed Nov 21, 2024
1 parent 80ff915 commit b5d8833
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 10 deletions.
5 changes: 5 additions & 0 deletions src/js/compare-landmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ class compareLandmark {
title: null,
description: null,
location: null,
zoom: null,
color: null,
icon: null,
layer1: null,
layer2: null,
mode: null,
};

// ID du point de repère s'il s'agit d'une modification d'un point de repère existant
Expand Down
29 changes: 20 additions & 9 deletions src/js/event-listeners.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,17 +282,28 @@ function addListeners() {
const zoom = parseFloat(urlParams.get("z")) || map.getZoom();
const center = { lng: parseFloat(urlParams.get("lng")), lat: parseFloat(urlParams.get("lat")) };
map.flyTo({zoom: zoom, center: center});
if (urlParams.get("l1") && urlParams.get("l2") && urlParams.get("m")) {
map.once("moveend", () => {
Globals.menu.open("compare");
Globals.compare.setParams({
zoom: zoom - 1,
mode: urlParams.get("m"),
if (urlParams.get("l1") && urlParams.get("l2") && urlParams.get("m") && urlParams.get("title") && urlParams.get("text") && urlParams.get("color")) {
const feature = {
type: "Feature",
id: -1,
geometry: {
type: "Point",
coordinates: [center.lng, center.lat],
},
properties: {
accroche: urlParams.get("title"),
theme: urlParams.get("title"),
text: urlParams.get("text"),
zoom: zoom,
color: urlParams.get("color"),
icon: `compare-landmark-${urlParams.get("color")}`,
layer1: urlParams.get("l1"),
layer2: urlParams.get("l2"),
center: center,
});
});
mode: urlParams.get("m"),
visible: true,
}
};
Globals.myaccount.addCompareLandmark(feature);
} else {
map.once("moveend", () => {
Globals.position.compute({ lngLat: center }).then(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/js/my-account/my-account.js
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@ https://cartes-ign.ign.fr?lng=${landmark.geometry.coordinates[0]}&lat=${landmark
title: `${props.accroche}`,
text: `${props.accroche}
${props.text}`,
url: `https://cartes-ign.ign.fr?lng=${compareLandmark.geometry.coordinates[0]}&lat=${compareLandmark.geometry.coordinates[1]}&z=${props.zoom}&l1=${props.layer1}&l2=${props.layer2}&m=${props.mode}&title=${props.accroche}`,
url: `https://cartes-ign.ign.fr?lng=${compareLandmark.geometry.coordinates[0]}&lat=${compareLandmark.geometry.coordinates[1]}&z=${props.zoom}&l1=${props.layer1}&l2=${props.layer2}&m=${props.mode}&title=${props.accroche}&text=${props.text}&color=${props.color}`,
dialogTitle: "Partager mon point de repère Comparer",
});
}
Expand Down

0 comments on commit b5d8833

Please sign in to comment.