Skip to content

Commit 51f5f29

Browse files
committed
feat(location): battery optimization. feat(geotrek): change threshold for btns disappearance. fix(sentiers): cohérence toponyme affiché avec colet
1 parent 811d99b commit 51f5f29

18 files changed

Lines changed: 394 additions & 103 deletions

config/gfi-rules.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"ITINERAIRES-RANDO-TMS$TMS": {
2+
"IGNF_SENTIERS-RANDONNEE-BALISES$TMS": {
33
"0": {
44
"pretitle": "<span class=\"filterTitleImg noBorder autoSize source{{sources}}\" style=\"background-image:url('data/img/pathMarks/{{nature}}.png');background-position:center\"></span>",
55
"title": "@toponyme",
@@ -33,14 +33,10 @@
3333
["<hr>"],
3434
["<p class=\"monumentsHistoriquesContent\"><b>Contacts&nbsp;:</b></p>"],
3535
["<div class=\"positionInfoFlex\">"],
36-
["<p>{{contactAdditionalInfo}}</p>"],
3736
["<p class=\"positionTelephone positionInfo\"><a target=\"_blank\" href=\"tel:{{registrationPhone}}\">Téléphone</a></p>"],
3837
["<p class=\"positionWeb positionInfo\"><a target=\"_blank\" href=\"{{registrationEmail}}\">Contacter</a></p>"],
3938
["<p class=\"positionWeb positionInfo\"><a target=\"_blank\" href=\"{{registrationWeb}}\">Site web</a></p>"],
4039
["<p class=\"positionWeb positionFacebook positionInfo\"><a target=\"_blank\" href=\"{{registrationFacebook}}\">Facebook</a></p>"],
41-
["<p class=\"positionTelephone positionInfo\"><a target=\"_blank\" href=\"tel:{{creatorPhone}}\">Téléphone</a></p>"],
42-
["<p class=\"positionWeb positionInfo\"><a target=\"_blank\" href=\"{{creatorEmail}}\">Contacter</a></p>"],
43-
["<p class=\"positionWeb positionInfo\"><a target=\"_blank\" href=\"{{creatorUrl}}\">Site web</a></p>"],
4440
["</div>"]
4541
]
4642
}

config/layer-tags.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"season_tag": {
3-
"layers": ["DATATOURISME.FMA$TMS", "ITINERAIRES-RANDO-TMS$TMS", "HIKING.GEOTREK$TMS", "IGNF_SITES-UNESCO$WMS", "POI.MONUMENTS_BDD_WLD_WM$WMS", "POI.MUSEUM$WMS"],
3+
"layers": ["DATATOURISME.FMA$TMS", "IGNF_SENTIERS-RANDONNEE-BALISES$TMS", "HIKING.GEOTREK$TMS", "IGNF_SITES-UNESCO$WMS", "POI.MONUMENTS_BDD_WLD_WM$WMS", "POI.MUSEUM$WMS"],
44
"name": "Pack été",
55
"textColor": "#3F4A55",
66
"tagColor": "#FFF200",
77
"tagIcon": "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwXzUwNzFfMTI3ODMpIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik04LjY2NjY5IDEzLjMzMzNWMTUuMzMzM0g3LjMzMzM1VjEzLjMzMzNIOC42NjY2OVpNMTIuMjQyNyAxMS4zTDEzLjY1NjcgMTIuNzE0TDEyLjcxNCAxMy42NTY2TDExLjMgMTIuMjQyNkwxMi4yNDI3IDExLjNaTTMuNzU3MzUgMTEuM0w0LjcwMDAyIDEyLjI0MjZMMy4yODYwMiAxMy42NTY2TDIuMzQzMzUgMTIuNzE0TDMuNzU3MzUgMTEuM1pNOC4wMDAwMiAzLjk5OTk2QzEwLjIwOTIgMy45OTk5NiAxMiA1Ljc5MDgyIDEyIDcuOTk5OTZDMTIgMTAuMjA5MSAxMC4yMDkyIDEyIDguMDAwMDIgMTJDNS43OTA4OCAxMiA0LjAwMDAyIDEwLjIwOTEgNC4wMDAwMiA3Ljk5OTk2QzQuMDAwMDIgNS43OTA4MiA1Ljc5MDg4IDMuOTk5OTYgOC4wMDAwMiAzLjk5OTk2Wk04LjAwMDAyIDUuMzMzMjlDNi41MjcyNiA1LjMzMzI5IDUuMzMzMzUgNi41MjcyIDUuMzMzMzUgNy45OTk5NkM1LjMzMzM1IDkuNDcyNzIgNi41MjcyNiAxMC42NjY2IDguMDAwMDIgMTAuNjY2NkM5LjQ3Mjc4IDEwLjY2NjYgMTAuNjY2NyA5LjQ3MjcyIDEwLjY2NjcgNy45OTk5NkMxMC42NjY3IDYuNTI3MiA5LjQ3Mjc4IDUuMzMzMjkgOC4wMDAwMiA1LjMzMzI5Wk0xNS4zMzM0IDcuMzMzMjlWOC42NjY2M0gxMy4zMzM0VjcuMzMzMjlIMTUuMzMzNFpNMi42NjY2OSA3LjMzMzI5VjguNjY2NjNIMC42NjY2ODdWNy4zMzMyOUgyLjY2NjY5Wk0zLjI4NjAyIDIuMzQzMjlMNC43MDAwMiAzLjc1NzI5TDMuNzU3MzUgNC42OTk5NkwyLjM0MzM1IDMuMjg2NjNWMy4yODU5NkwzLjI4NjAyIDIuMzQzMjlaTTEyLjcxNCAyLjM0MjYzTDEzLjY1NjcgMy4yODU5NkwxMi4yNDI3IDQuNjk5OTZMMTEuMyAzLjc1NzI5TDEyLjcxNCAyLjM0MzI5VjIuMzQyNjNaTTguNjY2NjkgMC42NjY2MjZWMi42NjY2M0g3LjMzMzM1VjAuNjY2NjI2SDguNjY2NjlaIiBmaWxsPSIjMDkxNjI1Ii8+CjwvZz4KPGRlZnM+CjxjbGlwUGF0aCBpZD0iY2xpcDBfNTA3MV8xMjc4MyI+CjxyZWN0IHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0id2hpdGUiLz4KPC9jbGlwUGF0aD4KPC9kZWZzPgo8L3N2Zz4K"
88
}
9-
}
9+
}

config/layers-config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@
281281
"styles": ["https://ignf.github.io/cartes-ign-app/datatourisme.json", "data/datatourisme.json"],
282282
"maj": "Juin 2026, mise à jour quotidienne"
283283
},
284-
"ITINERAIRES-RANDO-TMS$TMS": {
284+
"IGNF_SENTIERS-RANDONNEE-BALISES$TMS": {
285285
"new": true,
286286
"serverUrl": "https://data.geopf.fr/private/tms/1.0.0/",
287287
"interactive": true,

config/thematics-layer-config-new.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"name": "Tourisme et loisirs",
1919
"layers": [
2020
"DATATOURISME.FMA$TMS",
21-
"ITINERAIRES-RANDO-TMS$TMS",
21+
"IGNF_SENTIERS-RANDONNEE-BALISES$TMS",
2222
"HIKING.GEOTREK$TMS",
2323
"IGNF_SITES-UNESCO$WMS",
2424
"POI.MONUMENTS_BDD_WLD_WM$WMS",

src/css/my-account.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,7 @@ div[id^=route-summary-div_ID_] {
443443
border-radius: 100%;
444444
background-size: 25px;
445445
background-position: center;
446+
flex-shrink: 0;
446447
}
447448

448449
.landmarkSummaryIconlandmark-icon-favourite {

src/css/position.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,6 @@
11131113
}
11141114

11151115
@media not (min-width: 400px), not (min-aspect-ratio: 1/1) {
1116-
#positionContainer:has(.sentierBalise),
11171116
#positionContainer:has(.geotrek) {
11181117
max-height: calc(100vh - 100vw);
11191118
overflow-y: hidden;
@@ -1122,12 +1121,10 @@
11221121
overscroll-behavior: auto;
11231122
}
11241123

1125-
#positionContainer.tabScrolledMax:has(.sentierBalise),
11261124
#positionContainer.tabScrolledMax:has(.geotrek) {
11271125
overflow-y: scroll;
11281126
}
11291127

1130-
#positionContainer:has(.sentierBalise) .divPositionTitleWrapper,
11311128
#positionContainer:has(.geotrek) .divPositionTitleWrapper {
11321129
position: sticky;
11331130
top: 0;
@@ -1137,7 +1134,6 @@
11371134
padding-bottom: 15px;
11381135
}
11391136

1140-
#positionContainer:has(.sentierBalise) .positionHtmlBeforeAddress,
11411137
#positionContainer:has(.geotrek) .positionHtmlBeforeAddress {
11421138
margin-top: -15px;
11431139
}

src/js/event-listeners.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,6 @@ function addListeners() {
9191
Globals.backButtonState = "informationsScreenLegal";
9292
});
9393

94-
// Rotation du marqueur de position (android)
95-
if (Capacitor.getPlatform() !== "ios") {
96-
window.addEventListener("deviceorientationabsolute", Location.getOrientation, true);
97-
}
98-
9994
// Action du backbutton
10095
document.addEventListener("backbutton", State.onBackKeyDown, false);
10196
DOM.$tabClose.addEventListener("click", State.onBackKeyDown, false);
@@ -116,7 +111,10 @@ function addListeners() {
116111
};
117112

118113
// Sauvegarde de l'état de l'application
119-
App.addListener("appStateChange", saveState);
114+
App.addListener("appStateChange", (state) => {
115+
saveState();
116+
Location.handleAppStateChange(state);
117+
});
120118
document.addEventListener("pause", saveState);
121119
window.addEventListener("beforeunload", saveState);
122120

@@ -318,7 +316,11 @@ function addListeners() {
318316
if (document.getElementById("eventMapBtn")) {
319317
document.getElementById("eventMapBtn").classList.remove("opacity0");
320318
}
321-
const thresh = window.innerHeight / 2;
319+
let thresh = window.innerHeight / 2;
320+
const hasGeotrek = document.querySelector("#positionWindow:not(.d-none) .geotrek");
321+
if (hasGeotrek) {
322+
thresh = window.innerHeight / 4;
323+
}
322324
if (!window.matchMedia("screen and (min-aspect-ratio: 1/1) and (min-width:400px)").matches && window.scrollY > thresh) {
323325
DOM.$bottomButtons.classList.add("opacity0");
324326
DOM.$routeDrawEdit.classList.add("opacity0");

src/js/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ function app() {
407407
}, 4000);
408408

409409
// Pich zoom sur img overlay
410-
new PinchZoom(document.getElementById("imgOverlayImage"));
410+
new PinchZoom(document.getElementById("imgOverlayImage"), {"draggableUnzoomed": false});
411411
}
412412

413413
app();

src/js/isochrone/isochrone.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ class Isochrone {
7272

7373
this.tempLayers = this.options.tempLayers || null;
7474
this.isochroneLayers = this.options.isochroneLayers || null;
75+
this.addedLayers = null;
7576

7677
// carte
7778
this.map = map;
@@ -382,11 +383,17 @@ class Isochrone {
382383
}
383384

384385
if (this.isochroneLayers && this.isochroneLayers.length > 0) {
386+
this.addedLayers = [];
385387
settings.layersToDisplay.forEach((id) => {
388+
let isAdded = true;
386389
if (this.map.getLayer(id)) {
387390
document.getElementById(id.split("$$$")[1]).click();
391+
isAdded = false;
388392
}
389393
document.getElementById(id.split("$$$")[1]).click();
394+
if (isAdded) {
395+
this.addedLayers.push(id);
396+
}
390397
const addLayerCallback = (e) => {
391398
if (e.detail.id === id.split("$$$")[1]) {
392399
this.map.setFilter(id, ["within", this.polygon]);
@@ -505,6 +512,9 @@ class Isochrone {
505512
this.map.setFilter(`${layer.layerInLayerId}$$$${layer.layerId}`, null);
506513
}
507514
});
515+
this.addedLayers.forEach((id) => {
516+
document.getElementById(id.split("$$$")[1]).click();
517+
});
508518
}
509519
this.filter = null;
510520
this.previousFilters = {};

src/js/map-buttons-listeners.js

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,43 @@ import State from "./state";
1212
import { Capacitor } from "@capacitor/core";
1313

1414
const addListeners = () => {
15+
const longPressDelay = 700;
16+
let longPressTimerId = null;
17+
let suppressClickUntil = 0;
18+
19+
const clearLongPressTimer = () => {
20+
if (longPressTimerId !== null) {
21+
clearTimeout(longPressTimerId);
22+
longPressTimerId = null;
23+
}
24+
};
25+
26+
const startLongPress = () => {
27+
clearLongPressTimer();
28+
longPressTimerId = setTimeout(() => {
29+
suppressClickUntil = Date.now() + 600;
30+
Location.disableLocationListeningCompletely();
31+
clearLongPressTimer();
32+
}, longPressDelay);
33+
};
1534

1635
// Bouton Geolocalisation
17-
DOM.$geolocateBtn.addEventListener("click", () => { Location.locationOnOff(); });
36+
DOM.$geolocateBtn.addEventListener("click", () => {
37+
if (Date.now() < suppressClickUntil) {
38+
return;
39+
}
40+
Location.locationOnOff();
41+
});
42+
DOM.$geolocateBtn.addEventListener("mousedown", startLongPress);
43+
DOM.$geolocateBtn.addEventListener("touchstart", startLongPress, {passive: true});
44+
DOM.$geolocateBtn.addEventListener("mouseup", clearLongPressTimer);
45+
DOM.$geolocateBtn.addEventListener("mouseleave", clearLongPressTimer);
46+
DOM.$geolocateBtn.addEventListener("touchend", clearLongPressTimer);
47+
DOM.$geolocateBtn.addEventListener("touchcancel", clearLongPressTimer);
1848
// HACK: ios
1949
if (Capacitor.getPlatform() === "ios") {
2050
DOM.$geolocateBtn.addEventListener("click", () => {
21-
if (typeof DeviceOrientationEvent !== "undefined" && typeof DeviceOrientationEvent.requestPermission === "function") {
22-
DeviceOrientationEvent.requestPermission()
23-
.then(permissionState => {
24-
if (permissionState === "granted") {
25-
window.addEventListener("deviceorientation", Location.getOrientation);
26-
}
27-
})
28-
.catch(console.error);
29-
}
51+
Location.requestOrientationPermission();
3052
});
3153
}
3254

0 commit comments

Comments
 (0)