This commit is contained in:
Jens Cornelsen
2024-12-09 22:45:07 +01:00
parent 54cbeb856b
commit fafe43b982

View File

@@ -53,26 +53,6 @@
ctx.stroke();
}
// Clear the canvas and reset logs
function clearCanvas() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
capturedLines = [];
startX = null;
startY = null;
drawGrid(); // Redraw the grid after clearing
updateLineLog();
}
// Update the captured lines log
function updateLineLog() {
lineLog.innerHTML = capturedLines
.map((line, index) => {
const lengthInMeters = calculateLineLengthInMeters(line.startX, line.startY, line.endX, line.endY);
return <li>line-log ${index + 1}: Start (${line.startX}, ${line.startY}), End (${line.endX}, ${line.endY}), Length: ${lengthInMeters.toFixed(2)} m</li>;
})
.join('');
}
// Calculate the length of a line in meters
function calculateLineLengthInMeters(x1, y1, x2, y2) {
const dx = x2 - x1;