Skip to content

Commit

Permalink
Move clear
Browse files Browse the repository at this point in the history
  • Loading branch information
Chi-EEE committed Nov 30, 2023
1 parent 15969e1 commit a878858
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion frontend/src/lib/LidarViewer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
function draw() {
const ctx: CanvasRenderingContext2D = canvas.getContext("2d")!!;
ctx.clearRect(0, 0, canvas.width, canvas.height);
for (const point of points) {
const x = canvas.width / 2 + point.distance * Math.cos(point.angle);
const y =
canvas.height / 2 + point.distance * Math.sin(point.angle);
ctx.fillRect(x, y, 1, 1);
}
ctx.clearRect(0, 0, canvas.width, canvas.height);
}
onMount(async () => {
Expand Down

0 comments on commit a878858

Please sign in to comment.