mirror of
https://forge.chapril.org/tykayn/libre-charge-map
synced 2025-10-04 17:04:53 +02:00
ajout display du temps de recharge
This commit is contained in:
parent
24e1800085
commit
74eb8a9c01
5 changed files with 29 additions and 42 deletions
|
@ -168,6 +168,8 @@ function searchLocation() {
|
|||
|
||||
// Toujours sélectionner le premier résultat
|
||||
moveToLocation(data[0]);
|
||||
displayPointsFromApi();
|
||||
|
||||
|
||||
// Si il y a plus d'un résultat, les afficher quand même dans la liste
|
||||
if (data.length > 1) {
|
||||
|
@ -700,8 +702,7 @@ function eachFeature(feature, layer, stats) {
|
|||
const h = Math.floor(minutes / 60);
|
||||
const m = minutes % 60;
|
||||
rechargeTimeText = `<div class="recharge-time">
|
||||
⏱️ Temps moyen de recharge :
|
||||
<strong>${h > 0 ? h + 'h ' : ''}${m} min</strong>
|
||||
⏱️ + ${averageChargeKwh} kWh en <strong>${h > 0 ? h + 'h ' : ''}${m} min</strong>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
|
@ -885,8 +886,8 @@ function fillDetailsWithFeature(feature) {
|
|||
const h = Math.floor(minutes / 60);
|
||||
const m = minutes % 60;
|
||||
rechargeTimeText = `<div class="recharge-time">
|
||||
⏱️ Temps estimé pour charger ${averageChargeKwh} kWh à ${outPowerGuessed} kW :
|
||||
<strong>${h > 0 ? h + 'h ' : ''}${m} min</strong>
|
||||
⏱️ <strong>${h > 0 ? h + 'h ' : ''}${m} min</strong> pour ${averageChargeKwh} kWh à ${outPowerGuessed} kW :
|
||||
|
||||
</div>`;
|
||||
} else {
|
||||
rechargeTimeText = `<div class="recharge-time">⏱️ Temps estimé : puissance inconnue</div>`;
|
||||
|
@ -1277,7 +1278,6 @@ function searchOsmoseIssues(map) {
|
|||
const clickedMarker = e.target;
|
||||
const storedIssueId = clickedMarker.options.issueId;
|
||||
|
||||
handleMarkerClick(clickedMarker, map); // Nouvelle gestion du clic
|
||||
|
||||
const detailUrl = `https://osmose.openstreetmap.fr/api/0.3/issue/${storedIssueId}?langs=auto`;
|
||||
console.log("Récupération des détails pour l'issue:", detailUrl);
|
||||
|
@ -1347,36 +1347,6 @@ function searchOsmoseIssues(map) {
|
|||
});
|
||||
}
|
||||
|
||||
// Modifier la gestion du clic sur les marqueurs Osmose
|
||||
function handleMarkerClick(marker, map) {
|
||||
// const popup = marker.getPopup();
|
||||
// const markerLatLng = marker.getLatLng();
|
||||
|
||||
// Calculer la position relative du marqueur dans la vue
|
||||
// const markerPoint = map.latLngToContainerPoint(markerLatLng);
|
||||
// const mapHeight = map.getContainer().clientHeight;
|
||||
|
||||
// Si le marqueur est dans la moitié supérieure de l'écran
|
||||
// if (markerPoint.y < mapHeight / 2) {
|
||||
// Calculer le décalage nécessaire pour centrer la popup
|
||||
// const targetLatLng = map.containerPointToLatLng([
|
||||
// markerPoint.x,
|
||||
// mapHeight / 2
|
||||
// ]);
|
||||
|
||||
// Déplacer la carte avec une animation
|
||||
// map.once('moveend', () => {
|
||||
// marker.openPopup();
|
||||
// });
|
||||
|
||||
// map.panTo(targetLatLng, {
|
||||
// animate: true,
|
||||
// duration: 0.25
|
||||
// });
|
||||
// } else {
|
||||
// // marker.openPopup();
|
||||
// }
|
||||
}
|
||||
|
||||
// Ajouter un écouteur d'événements pour le changement de visibilité des calques
|
||||
function init() {
|
||||
|
@ -1491,7 +1461,17 @@ function init() {
|
|||
});
|
||||
});
|
||||
|
||||
$('#searchButton').on('click', searchLocation);
|
||||
$('#searchButton').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
searchLocation();
|
||||
});
|
||||
$('#searchLocation').on('keydown', function (e) {
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
searchLocation();
|
||||
}
|
||||
});
|
||||
|
||||
$('#shareUrl').on('click', copyCurrentUrl);
|
||||
$('#filter_max_output').on('input', function () {
|
||||
const value = $(this).val();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue