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;
|
color: white;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
border: none;
|
border: none;
|
||||||
cursor: pointer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
button {
|
button {
|
||||||
|
@ -150,6 +149,7 @@
|
||||||
<input id="image-bits" type="text" name="image-bits">
|
<input id="image-bits" type="text" name="image-bits">
|
||||||
|
|
||||||
Signature (optional): <input id="signature-input" onchange="logSignature();" type="text" name="signature">
|
Signature (optional): <input id="signature-input" onchange="logSignature();" type="text" name="signature">
|
||||||
|
|
||||||
<input id="submit-input" type="submit" value="Farp it">
|
<input id="submit-input" type="submit" value="Farp it">
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
@ -161,6 +161,8 @@
|
||||||
const bits = document.getElementById("image-bits");
|
const bits = document.getElementById("image-bits");
|
||||||
const ctx = canvas.getContext("2d");
|
const ctx = canvas.getContext("2d");
|
||||||
|
|
||||||
|
const penButton = document.getElementById("pen-button");
|
||||||
|
const eraserButton = document.getElementById("eraser-button");
|
||||||
const submit = document.getElementById("submit-input");
|
const submit = document.getElementById("submit-input");
|
||||||
|
|
||||||
// tools
|
// tools
|
||||||
|
@ -170,19 +172,20 @@
|
||||||
for (let i = 0; i < pen.data.length; i += 4) {
|
for (let i = 0; i < pen.data.length; i += 4) {
|
||||||
pen.data[i+3] = 255;
|
pen.data[i+3] = 255;
|
||||||
}
|
}
|
||||||
const penButton = document.getElementById("pen-button");
|
|
||||||
|
|
||||||
const eraser = ctx.createImageData(2, 2);
|
const eraser = ctx.createImageData(2, 2);
|
||||||
for (let i = 0; i < eraser.data.length; i += 4) {
|
for (let i = 0; i < eraser.data.length; i += 4) {
|
||||||
eraser.data[i+3] = 0;
|
eraser.data[i+3] = 0;
|
||||||
}
|
}
|
||||||
const eraserButton = document.getElementById("eraser-button");
|
|
||||||
|
|
||||||
|
//
|
||||||
var isDrawing = false;
|
var isDrawing = false;
|
||||||
|
|
||||||
canvas.onmousedown = function() {
|
canvas.onmousedown = function() {
|
||||||
submit.disabled = false;
|
submit.disabled = false;
|
||||||
isDrawing = true;
|
isDrawing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
document.onmouseup = function() {
|
document.onmouseup = function() {
|
||||||
isDrawing = false;
|
isDrawing = false;
|
||||||
// write image-bits for posting
|
// write image-bits for posting
|
||||||
|
|
Reference in a new issue