This commit is contained in:
+13
-7
@@ -149,23 +149,29 @@
|
|||||||
return nearestPendingPoi(poiMetrics(state.position));
|
return nearestPendingPoi(poiMetrics(state.position));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setRouteControlSummary(titleText, detailText) {
|
||||||
|
$('#route-control-title').text(titleText);
|
||||||
|
$('#route-control-next').text(detailText);
|
||||||
|
$('.route-control-summary').attr('aria-label', `${titleText}. ${detailText}`);
|
||||||
|
}
|
||||||
|
|
||||||
function updateRouteControlSummary() {
|
function updateRouteControlSummary() {
|
||||||
const title = $('#route-control-title');
|
|
||||||
const next = $('#route-control-next');
|
|
||||||
if (!state.route) {
|
if (!state.route) {
|
||||||
title.text('Route wählen');
|
setRouteControlSummary('Route wählen', 'Aktive und lokale Strecken');
|
||||||
next.text('Aktive und lokale Strecken');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
title.text(state.route.name || 'Route');
|
const titleText = state.route.name || 'Route';
|
||||||
const metric = nextPoiMetric();
|
const metric = nextPoiMetric();
|
||||||
if (!metric) {
|
if (!metric) {
|
||||||
next.text((state.route.pois || []).length ? 'Alle Streckenpunkte erreicht' : 'Keine Streckenpunkte vorhanden');
|
const detailText = (state.route.pois || []).length
|
||||||
|
? 'Alle Streckenpunkte erreicht'
|
||||||
|
: 'Keine Streckenpunkte vorhanden';
|
||||||
|
setRouteControlSummary(titleText, detailText);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const distance = metric.distance == null ? '' : ` · ${Math.round(metric.distance)} m`;
|
const distance = metric.distance == null ? '' : ` · ${Math.round(metric.distance)} m`;
|
||||||
next.text(`Nächster Streckenpunkt: ${metric.poi.title}${distance}`);
|
setRouteControlSummary(titleText, `Nächster Streckenpunkt: ${metric.poi.title}${distance}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderRouteControlList(selector, routes, source, emptyText) {
|
function renderRouteControlList(selector, routes, source, emptyText) {
|
||||||
|
|||||||
Reference in New Issue
Block a user