Skip to content

Commit

Permalink
canvas will figure out when it can draw the images itself
Browse files Browse the repository at this point in the history
  • Loading branch information
luttje committed Sep 27, 2024
1 parent 417114f commit 1cfb8f0
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -365,18 +365,6 @@ <h2 class="text-3xl bg-curioSecondary/50 text-curioPrimary text-center font-bold
backgroundCanvas.drawImage(stopSignRoute, pointsOfInterest.stopSignRoute.x, pointsOfInterest.stopSignRoute.y, stopSignSize.width, stopSignSize.height);
}

// Only start drawing when both images are loaded
let readyToDraw = false;
busToCentral.onload = () => {
busToRoute.onload = () => {
background.onload = () => {
stopSignRoute.onload = () => {
readyToDraw = true;
}
}
}
}

let debugHelpFindBusPositions = false;
let mouseX = 0;
let mouseY = 0;
Expand Down Expand Up @@ -455,11 +443,6 @@ <h2 class="text-3xl bg-curioSecondary/50 text-curioPrimary text-center font-bold
drawBus(busToCentral, mouseX, mouseY, false);
}

if (!readyToDraw) {
requestAnimationFrame(draw);
return;
}

const now = new Date().getTime();

busAnimationData.forEach((bus, index) => {
Expand Down

0 comments on commit 1cfb8f0

Please sign in to comment.