From 389eeeb48d5bc1ca6eb04517152b60450e7705b5 Mon Sep 17 00:00:00 2001 From: Anthony Wang Date: Mon, 29 Jan 2024 22:22:58 +0000 Subject: Limit velocity change from click, add position: fixed so this finally works on mobile --- script.js | 2 +- style.css | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/script.js b/script.js index 1f401e6..7018f86 100644 --- a/script.js +++ b/script.js @@ -202,7 +202,7 @@ function tick() { // Use click to update velocities function updatev(event) { for (a of A) { - let d = ds(a, {x: event.clientX, y: event.clientY}) + let d = Math.max(ds(a, {x: event.clientX, y: event.clientY}), 100) a.vx += 100 * (a.x - event.clientX) / d a.vy += 100 * (a.y - event.clientY) / d } diff --git a/style.css b/style.css index 72f1fa4..dc17f93 100644 --- a/style.css +++ b/style.css @@ -1,4 +1,5 @@ body { + position: fixed; overflow: hidden; touch-action: none; } -- cgit v1.2.3-70-g09d2