Limit velocity change from click, add position: fixed so this finally works on mobile
This commit is contained in:
parent
ab39b82693
commit
389eeeb48d
2 changed files with 2 additions and 1 deletions
|
@ -202,7 +202,7 @@ function tick() {
|
||||||
// Use click to update velocities
|
// Use click to update velocities
|
||||||
function updatev(event) {
|
function updatev(event) {
|
||||||
for (a of A) {
|
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.vx += 100 * (a.x - event.clientX) / d
|
||||||
a.vy += 100 * (a.y - event.clientY) / d
|
a.vy += 100 * (a.y - event.clientY) / d
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
body {
|
body {
|
||||||
|
position: fixed;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
touch-action: none;
|
touch-action: none;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue