Update index.php
This commit is contained in:
parent
ed1a5c48d2
commit
762688948c
1 changed files with 6 additions and 3 deletions
|
@ -45,7 +45,6 @@
|
|||
color: white;
|
||||
font-weight: 600;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button {
|
||||
|
@ -150,6 +149,7 @@
|
|||
<input id="image-bits" type="text" name="image-bits">
|
||||
|
||||
Signature (optional): <input id="signature-input" onchange="logSignature();" type="text" name="signature">
|
||||
|
||||
<input id="submit-input" type="submit" value="Farp it">
|
||||
</form>
|
||||
|
||||
|
@ -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
|
||||
|
|
Reference in a new issue