This commit is contained in:
Jens Cornelsen
2024-12-09 21:00:17 +01:00
parent a2af6c9249
commit 4e49f21b91

View File

@@ -204,14 +204,6 @@ import Layout from "#layouts/layoutCAD.astro";
const endX = snapToGrid(e.offsetX); const endX = snapToGrid(e.offsetX);
const endY = snapToGrid(e.offsetY); const endY = snapToGrid(e.offsetY);
// If it's a point, draw a point
if (startX === endX && startY === endY) {
drawPoint(startX, startY);
} else {
// Otherwise, draw the line
drawLine(startX, startY, endX, endY);
}
// Update the last endpoint // Update the last endpoint
lastEndPoint = { x: endX, y: endY }; lastEndPoint = { x: endX, y: endY };
@@ -230,14 +222,6 @@ import Layout from "#layouts/layoutCAD.astro";
ctx.stroke(); ctx.stroke();
} }
// Function to draw a point
function drawPoint(x, y) {
ctx.beginPath();
ctx.fillStyle = "#000000"; // Black point
ctx.arc(x, y, 3, 0, 2 * Math.PI); // Draw a small circle for the point
ctx.fill();
}
// Initialize the canvas // Initialize the canvas
drawGrid(); drawGrid();
</script> </script>