fix vacances
Deploy HouseHub / deploy (push) Successful in 1s

This commit is contained in:
FeFeClochette committed 2026-08-27 16:36:24 +02:00
1 parent b3139b577a
commit 32c291ff2c
1 file changed
+11 -7
+11 -7
View File
@@ -316,12 +316,10 @@ function initDetailMap() {
const mapPadding = window.innerWidth < 768 ? [20, 20] : [50, 50]; const mapPadding = window.innerWidth < 768 ? [20, 20] : [50, 50];
// 3. Tracés OSRM et calculs // 3. Tracés OSRM et calculs
if (latlngs.length === 1) { const routePromises = []; // On déclare routePromises directement
detailMap.setView(latlngs[0], 12);
} else if (latlngs.length > 1) {
detailMap.fitBounds(bounds, { padding: mapPadding });
const routePromises = []; if (latlngs.length > 1) {
// Les appels setView et fitBounds ont été déplacés à l'étape 5 !
for (let i = 0; i < latlngs.length - 1; i++) { for (let i = 0; i < latlngs.length - 1; i++) {
const startPt = MAP_POINTS[i]; const startPt = MAP_POINTS[i];
@@ -514,7 +512,13 @@ function initDetailMap() {
// 5. Fix Leaflet Resize // 5. Fix Leaflet Resize
setTimeout(() => { setTimeout(() => {
if (detailMap) { if (detailMap) {
detailMap.invalidateSize(); detailMap.invalidateSize(); // Force Leaflet à prendre la vraie taille de la fenêtre
if (latlngs.length === 1) {
detailMap.setView(latlngs[0], 12);
} else if (latlngs.length > 1) {
detailMap.fitBounds(bounds, { padding: mapPadding });
}
} }
}, 300); }, 300);
@@ -531,7 +535,7 @@ function initDetailMap() {
function panMapTo(lat, lng) { function panMapTo(lat, lng) {
if (detailMap) { if (detailMap) {
detailMap.setView([lat, lng], 14, { animate: true }); detailMap.setView([lat, lng], 12, { animate: true });
if (window.innerWidth < 768) { if (window.innerWidth < 768) {
const mapDiv = document.getElementById("tripMap"); const mapDiv = document.getElementById("tripMap");