Update index.php
This commit is contained in:
parent
e88d1358bc
commit
ad0130e1de
1 changed files with 4 additions and 6 deletions
10
index.php
10
index.php
|
@ -99,8 +99,9 @@
|
||||||
<div class="post" style="border-top-left-radius: 0; border-top-right-radius: 0;">
|
<div class="post" style="border-top-left-radius: 0; border-top-right-radius: 0;">
|
||||||
<h1 style="margin-bottom: 4px;"><span style="color: var(--accent);">furp</span>social</h1>
|
<h1 style="margin-bottom: 4px;"><span style="color: var(--accent);">furp</span>social</h1>
|
||||||
|
|
||||||
<canvas id="canvas-input" width="128" height="64"></canvas>
|
|
||||||
<form method="post" action="farp.php">
|
<form method="post" action="farp.php">
|
||||||
|
Test canvas for oekaki:<br>
|
||||||
|
<canvas id="canvas-input" width="128" height="64"></canvas>
|
||||||
<textarea id="body-input" name="body"></textarea>
|
<textarea id="body-input" name="body"></textarea>
|
||||||
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 type="submit" value="Farp it">
|
<input type="submit" value="Farp it">
|
||||||
|
@ -111,7 +112,6 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const canvas = document.getElementById("canvas-input");
|
const canvas = document.getElementById("canvas-input");
|
||||||
const crect = canvas.getBoundingClientRect();
|
|
||||||
const ctx = canvas.getContext("2d");
|
const ctx = canvas.getContext("2d");
|
||||||
|
|
||||||
const pen = ctx.createImageData(2, 2);
|
const pen = ctx.createImageData(2, 2);
|
||||||
|
@ -133,10 +133,8 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
function draw(e) {
|
function draw(e) {
|
||||||
var posX = e.offsetX * canvas.width / crect.width - 1;
|
var posX = e.offsetX * canvas.width / canvas.offsetWidth - 1;
|
||||||
var posY = e.offsetY * canvas.height / crect.height - 1;
|
var posY = e.offsetY * canvas.height / canvas.offsetWidth - 1;
|
||||||
|
|
||||||
console.log(canvas.width + " : " + crect.width);
|
|
||||||
|
|
||||||
ctx.putImageData(pen, posX, posY);
|
ctx.putImageData(pen, posX, posY);
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue