From f4b10b356de16726af8fe5123ff8c4f080cb313d Mon Sep 17 00:00:00 2001 From: carlfeynman Date: Wed, 13 Sep 2023 22:42:00 +0530 Subject: [PATCH] html updated --- index.html | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/index.html b/index.html index 315df66..a9d7e3a 100644 --- a/index.html +++ b/index.html @@ -1,17 +1,27 @@ + Whiteboard + +

Draw and Predict Handwritten Digits

@@ -58,28 +73,29 @@ var canvas = document.getElementById('whiteboard'); var context = canvas.getContext('2d'); var drawing = false; - + context.strokeStyle = 'white'; + canvas.addEventListener('mousedown', function (e) { drawing = true; context.beginPath(); context.moveTo(e.clientX - canvas.getBoundingClientRect().left, e.clientY - canvas.getBoundingClientRect().top); }); - + canvas.addEventListener('mousemove', function (e) { if (drawing) { context.lineTo(e.clientX - canvas.getBoundingClientRect().left, e.clientY - canvas.getBoundingClientRect().top); context.stroke(); } }); - + canvas.addEventListener('mouseup', function () { drawing = false; }); - + canvas.addEventListener('mouseout', function () { drawing = false; }); - + var clearButton = document.getElementById('clear-button'); clearButton.addEventListener('click', function () { context.clearRect(0, 0, canvas.width, canvas.height); @@ -95,4 +111,5 @@ }); - + + \ No newline at end of file