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