From 762688948cb640dfc5ed6269b0f65edd9d82c34f Mon Sep 17 00:00:00 2001 From: awesomeuser Date: Fri, 4 Aug 2023 21:07:03 +0000 Subject: [PATCH] Update index.php --- index.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/index.php b/index.php index dab31d9..1d4c244 100644 --- a/index.php +++ b/index.php @@ -45,7 +45,6 @@ color: white; font-weight: 600; border: none; - cursor: pointer; } button { @@ -150,6 +149,7 @@ Signature (optional): + @@ -161,6 +161,8 @@ const bits = document.getElementById("image-bits"); const ctx = canvas.getContext("2d"); + const penButton = document.getElementById("pen-button"); + const eraserButton = document.getElementById("eraser-button"); const submit = document.getElementById("submit-input"); // tools @@ -170,19 +172,20 @@ for (let i = 0; i < pen.data.length; i += 4) { pen.data[i+3] = 255; } - const penButton = document.getElementById("pen-button"); const eraser = ctx.createImageData(2, 2); for (let i = 0; i < eraser.data.length; i += 4) { eraser.data[i+3] = 0; } - const eraserButton = document.getElementById("eraser-button"); + // var isDrawing = false; + canvas.onmousedown = function() { submit.disabled = false; isDrawing = true; } + document.onmouseup = function() { isDrawing = false; // write image-bits for posting