From f678556ff5ef9728eba92d1ca63633cc1b0671f7 Mon Sep 17 00:00:00 2001 From: ElementalAlchemist Date: Wed, 13 Nov 2024 02:13:09 -0600 Subject: [PATCH] Show icons for points we've driven past --- thrimbletrimmer/driveclock/drive.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/thrimbletrimmer/driveclock/drive.js b/thrimbletrimmer/driveclock/drive.js index 40b1db9..b51cee9 100644 --- a/thrimbletrimmer/driveclock/drive.js +++ b/thrimbletrimmer/driveclock/drive.js @@ -152,7 +152,7 @@ async function drawRoad() { x += pixelWidth; } - x = BUS_FRONT_OFFSET; + x = 0; const currentPointProgress = distance % 360; let distanceToNextPoint; if (currentPointProgress <= 109.3) { @@ -161,9 +161,14 @@ async function drawRoad() { distanceToNextPoint = 469.3 - currentPointProgress; } + distanceToNextPoint += BUS_FRONT_OFFSET / (4 * scaleFactor); + if (distanceToNextPoint >= 360) { + distanceToNextPoint -= 360; + } + x += distanceToNextPoint * 4 * scaleFactor; context.drawImage(POINT_IMAGE, x - POINT_OFFSET, 0); - while (x < maxWidth) { + while (x < CANVAS_PIXEL_WIDTH) { x += 360 * 4 * scaleFactor; context.drawImage(POINT_IMAGE, x - POINT_OFFSET, 0); }