Skip to content

Commit

Permalink
fix(landmark): cant change visibility after click. fix(compare_poi): …
Browse files Browse the repository at this point in the history
…spaces replaced by _ on share
  • Loading branch information
azarz committed Jan 15, 2025
1 parent 286e9d1 commit a1202aa
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/js/event-listeners.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,9 @@ function addListeners() {
coordinates: [center.lng, center.lat],
},
properties: {
accroche: urlParams.get("title"),
theme: urlParams.get("title"),
text: urlParams.get("text"),
accroche: urlParams.get("title").replace(/%20/g, " "),
theme: urlParams.get("title").replace(/%20/g, " "),
text: urlParams.get("text").replace(/%20/g, " "),
zoom: zoom,
color: urlParams.get("color"),
icon: `compare-landmark-${urlParams.get("color")}`,
Expand Down
8 changes: 5 additions & 3 deletions src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,11 @@ function app() {
const center = { lng: parseFloat(urlParams.get("lng")), lat: parseFloat(urlParams.get("lat")) };
map.setCenter(center);
map.setZoom(parseFloat(urlParams.get("z")) || map.getZoom());
Globals.position.compute({ lngLat: center }).then(() => {
Globals.menu.open("position");
});
if (!(urlParams.get("l1") && urlParams.get("l2") && urlParams.get("m") && urlParams.get("title") && urlParams.get("text") && urlParams.get("color"))) {
Globals.position.compute({ lngLat: center }).then(() => {
Globals.menu.open("position");
});
}
if (Globals.searchResultMarker != null) {
Globals.searchResultMarker.remove();
Globals.searchResultMarker = null;
Expand Down
1 change: 0 additions & 1 deletion src/js/map-interactivity/interactivity-indicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ class InteractivityIndicator {
clearTimeout(this.timeoutID1);
clearTimeout(this.timeoutID2);
clearTimeout(this.timeoutID3);
console.log("coucou");
this.timeoutID1 = setTimeout(() => {
DOM.$interactivityBtn.classList.add("backgroundGreen");
DOM.$interactivityBtn.classList.add("widthOn");
Expand Down
12 changes: 9 additions & 3 deletions src/js/my-account/my-account.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,13 @@ class MyAccount {
if (DOM.$fullScreenBtn.querySelector("button").classList.contains("maplibregl-ctrl-shrink")) {
return;
}
const landmark = this.map.queryRenderedFeatures(e.point, {layers: [MyAccountLayers["landmark-casing"].id]})[0];
const landmarkMap = this.map.queryRenderedFeatures(e.point, {layers: [MyAccountLayers["landmark-casing"].id]})[0];
const landmark = {
type: "Feature",
id: landmarkMap.id,
geometry: landmarkMap.geometry,
properties: landmarkMap.properties,
};
const title = `<div id="landmarkPositionTitle" class="divLegendContainer landmarkPosition-${landmark.id}">
<label class="landmarkSummaryIcon landmarkSummaryIcon${landmark.properties.icon}"
style="background-color:${landmark.properties.color};
Expand All @@ -248,6 +254,7 @@ class MyAccount {
const deselectLandmarkCallback = () => {
clearInterval(intervalId);
landmark.properties.radiusRatio = 0;
this.__updateAccountLandmarksContainerDOMElement(this.landmarks);
this.#updateSources();
};
Globals.position.compute({
Expand Down Expand Up @@ -870,7 +877,6 @@ class MyAccount {
try {
let result;
if (value === "json") {
console.log(JSON.stringify(this.#routeToGeojson(route)));
result = await Filesystem.writeFile({
path: `${route.name.replace(/[&/\\#,+()$~%.'":*?<>{}]/g, "_")}.json`,
data: JSON.stringify(this.#routeToGeojson(route)),
Expand Down Expand Up @@ -979,7 +985,7 @@ https://cartes-ign.ign.fr?lng=${landmark.geometry.coordinates[0]}&lat=${landmark
*/
shareCompareLandmark(compareLandmark) {
let props = compareLandmark.properties;
let url = encodeURI(`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}`.replace(/ /g, "_"));
let url = encodeURI(`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}`.replace(/ /g, "%20"));
Share.share({
title: `${props.accroche}`,
text: `${props.accroche}
Expand Down
1 change: 0 additions & 1 deletion src/js/route-draw/route-draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,6 @@ class RouteDraw {
hide() {
const routeId = this.routeId;
if (routeId !== null) {
console.log(routeId);
Globals.myaccount.showRouteFromID(routeId);
}
Globals.menu.close("routeDraw");
Expand Down
1 change: 0 additions & 1 deletion src/js/utils/js-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ let jsUtils = {
debounce(callback, delay) {
var timer;
return function() {
console.log(delay);
var args = arguments;
var context = this;
clearTimeout(timer);
Expand Down

0 comments on commit a1202aa

Please sign in to comment.