From 3c1421ee8ad81547617865d5937f81a419c91551 Mon Sep 17 00:00:00 2001 From: Eyal Gruss Date: Sun, 14 Jan 2024 16:47:14 +0200 Subject: [PATCH] fix panning for alex/mobile --- resen/down/script.js | 5 +++++ resen/down/style.css | 1 + 2 files changed, 6 insertions(+) diff --git a/resen/down/script.js b/resen/down/script.js index a7985fd..592de9e 100644 --- a/resen/down/script.js +++ b/resen/down/script.js @@ -15,6 +15,10 @@ document.addEventListener('pointerup', () => { down = false }) +document.addEventListener('pointercancel', () => { + down = false +}) + document.addEventListener('pointermove', e => { if (!down) return @@ -27,4 +31,5 @@ document.addEventListener('pointermove', e => { dy *= 100 / (bg_size_factor*innerWidth/aspect_ratio-innerHeight) document.body.style.backgroundPositionX = Math.max(0, Math.min(bg_pos_pct_x + dx, 100)) + '%' document.body.style.backgroundPositionY = Math.max(0, Math.min(bg_pos_pct_y + dy, 100)) + '%' + // Note: not doing this in CSS due to bug in Firefox. See: https://bugzilla.mozilla.org/show_bug.cgi?id=1874606 }) \ No newline at end of file diff --git a/resen/down/style.css b/resen/down/style.css index 1256798..d54a45e 100644 --- a/resen/down/style.css +++ b/resen/down/style.css @@ -7,6 +7,7 @@ body { background-position: 43% 40%; background-size: 500%; --fg_dim: var(--fg); + touch-action: none; user-select: none; -webkit-user-select: none; }