summaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2026-10-27 16:37:43 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2026-10-27 16:37:43 +0100
commit8066a226f3ac6df3b5e591384a127ba8d81f2700 (patch)
tree8192a12fcbfdec762fc86dcc0dfe6f99b1d7de55 /crates
parentaec36a8d6087266a2c9c7569314e2306f2dcf298 (diff)
web: keep browser from stealing the pinch gesture
Firefox on Android may consume two-finger pinch for page zooming despite touch-action: none on the canvas. Disable page zooming via the viewport meta (maximum-scale=1, user-scalable=no) so the gesture reaches the app as pointer events; the app provides its own zoom. Also join touch pointers seen only via pointermove into the pointer table, so a swallowed second pointerdown cannot break pinch.
Diffstat (limited to 'crates')
-rw-r--r--crates/wipfel/index.html2
-rw-r--r--crates/wipfel/src/canvas_view.rs12
-rw-r--r--crates/wipfel/www/index.html2
3 files changed, 12 insertions, 4 deletions
diff --git a/crates/wipfel/index.html b/crates/wipfel/index.html
index d00adbe..2da0c81 100644
--- a/crates/wipfel/index.html
+++ b/crates/wipfel/index.html
@@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>wipfel — web based gipfel photogrammetry</title>
<link data-trunk rel="css" href="www/style.css" />
<link data-trunk rel="rust" />
diff --git a/crates/wipfel/src/canvas_view.rs b/crates/wipfel/src/canvas_view.rs
index b962f17..ac1d6ab 100644
--- a/crates/wipfel/src/canvas_view.rs
+++ b/crates/wipfel/src/canvas_view.rs
@@ -432,8 +432,16 @@ pub fn canvas_view(props: &Props) -> Html {
// update the pointer table and handle two-finger pinch
let pinch_ev = {
let mut d = drag.borrow_mut();
- if let Some(p) = d.pts.iter_mut().find(|(id, _)| *id == e.pointer_id()) {
- p.1 = (e.client_x() as f64, e.client_y() as f64);
+ let pos = (e.client_x() as f64, e.client_y() as f64);
+ match d.pts.iter_mut().find(|(id, _)| *id == e.pointer_id()) {
+ Some(p) => p.1 = pos,
+ // a touch pointermove for a pointer we never saw go
+ // down (lost pointerdown, e.g. swallowed by the
+ // browser) — join it so pinch still works
+ None if e.pointer_type() == "touch" && e.buttons() != 0 => {
+ d.pts.push((e.pointer_id(), pos));
+ }
+ None => {}
}
if d.pts.len() >= 2 {
let (x1, y1) = d.pts[0].1;
diff --git a/crates/wipfel/www/index.html b/crates/wipfel/www/index.html
index 5297a72..98f81e8 100644
--- a/crates/wipfel/www/index.html
+++ b/crates/wipfel/www/index.html
@@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>wipfel — web based gipfel photogrammetry</title>
<link rel="stylesheet" href="style.css" />
</head>