Fix bus stops disappearing early

The existing code tried to avoid infinite loops due to floating point math. It turns out the +1 was overzealous and caused bus stop signs to disappear before expected at high scale numbers.
bus-progress-ui
ElementalAlchemist 1 week ago
parent ee5a36f425
commit 8b7b87d450

@ -187,7 +187,7 @@ async function drawRoad() {
const distanceTrackedOnRoute = distanceTracked % 360; const distanceTrackedOnRoute = distanceTracked % 360;
let nextBusStopPosition = null; let nextBusStopPosition = null;
for (const busStopPosition of BUS_STOP_POSITIONS) { for (const busStopPosition of BUS_STOP_POSITIONS) {
if (busStopPosition >= distanceTrackedOnRoute + 1) { if (busStopPosition >= distanceTrackedOnRoute + 0.05) {
nextBusStopPosition = busStopPosition; nextBusStopPosition = busStopPosition;
break; break;
} }

Loading…
Cancel
Save