Skip to content

Commit

Permalink
after looping through segments remove highlight; fixes #387
Browse files Browse the repository at this point in the history
  • Loading branch information
karussell committed May 21, 2024
1 parent f7bec0c commit a6b9d68
Showing 1 changed file with 21 additions and 14 deletions.
35 changes: 21 additions & 14 deletions src/sidebar/RoutingResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -403,20 +403,27 @@ function RHButton(p: {
className={p.selected == p.type ? styles.selectedRouteHintButton : styles.routeHintButton}
onClick={() => {
p.setType(p.type)
let tmpDescription
if (p.type == 'get_off_bike') tmpDescription = p.description
else if (p.type == 'border') tmpDescription = p.description + ': ' + p.values[index]
else if (p.values && p.values[index]) {
if (p.type.includes('rating'))
tmpDescription = p.description + ': ' + p.value + ' (' + p.type + ':' + p.values[index] + ')'
else if (p.type.includes('steep')) tmpDescription = p.description + ': ' + p.values[index]
else tmpDescription = p.description + ': ' + p.value + ' ' + p.values[index]
} else tmpDescription = p.description + ': ' + p.value

p.setDescription(tmpDescription)
Dispatcher.dispatch(new PathDetailsElevationSelected(p.segments))
if (p.segments.length > index) Dispatcher.dispatch(new SetBBox(toBBox(p.segments[index])))
setIndex((index + 1) % p.segments.length)

if (index < 0) {
Dispatcher.dispatch(new PathDetailsElevationSelected([]))
p.setDescription('')
} else {
let tmpDescription
if (p.type == 'get_off_bike') tmpDescription = p.description
else if (p.type == 'border') tmpDescription = p.description + ': ' + p.values[index]
else if (p.values && p.values[index]) {
if (p.type.includes('rating'))
tmpDescription = p.description + ': ' + p.value + ' (' + p.type + ':' + p.values[index] + ')'
else if (p.type.includes('steep')) tmpDescription = p.description + ': ' + p.values[index]
else tmpDescription = p.description + ': ' + p.value + ' ' + p.values[index]
} else tmpDescription = p.description + ': ' + p.value

p.setDescription(tmpDescription)
Dispatcher.dispatch(new PathDetailsElevationSelected(p.segments))
if (p.segments.length > index) Dispatcher.dispatch(new SetBBox(toBBox(p.segments[index])))
}

setIndex(index + 1 >= p.segments.length ? -1 : index + 1)
}}
title={p.description}
>
Expand Down

0 comments on commit a6b9d68

Please sign in to comment.