CAD
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user