Skip to content

Commit

Permalink
Improved entropy collection canvas for touchscreens.
Browse files Browse the repository at this point in the history
  • Loading branch information
GlitchedPolygons committed Dec 15, 2023
1 parent 7a4ed8a commit 067917d
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions GlitchedPolygons.GlitchEd25519.BlazorWebApp/Pages/Keygen.razor
Original file line number Diff line number Diff line change
Expand Up @@ -139,22 +139,31 @@
configContext();
const stopDrawing = () =>
{
{
isMouseDown = false;
}
const startDrawing = event =>
{
isMouseDown = true;
[x, y] = [event.offsetX, event.offsetY];
event.preventDefault();
isMouseDown = true;
[x, y] =
[
event.changedTouches ? event.changedTouches[0].clientX : event.offsetX,
event.changedTouches ? event.changedTouches[0].clientY : event.offsetY
];
}
const drawLine = event =>
{
event.preventDefault();
if (isMouseDown)
{
const newX = event.offsetX;
const newY = event.offsetY;
const newX = event.changedTouches ? event.changedTouches[0].clientX : event.offsetX;
const newY = event.changedTouches ? event.changedTouches[0].clientY : event.offsetY;
context.beginPath();
context.moveTo(x, y);
Expand Down

0 comments on commit 067917d

Please sign in to comment.