From 0b85e7989eacb26d3496cdb98ed3221868a4013f Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Tue, 27 Oct 2026 13:41:53 +0100 Subject: web: hidden-peak heuristics in the UI with Show-hidden toggle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The core already ran both visibility heuristics (height/distance threshold via the Visibility slider, occlusion via mark_hidden with the cone-visibility slope test) — the web UI just ignored FLAG_HIDDEN. - guide dots: hidden peaks are filtered out by default; with the new Display > Show hidden peaks toggle they appear grey instead of green - hover and click hit-testing skip hidden peaks unless the toggle is on - Find Peak picker is unchanged (it lists pan.close, which always includes hidden peaks — same as desktop) --- crates/gipfel-web/src/canvas_view.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'crates/gipfel-web/src/canvas_view.rs') diff --git a/crates/gipfel-web/src/canvas_view.rs b/crates/gipfel-web/src/canvas_view.rs index ab72b7f..9d4338e 100644 --- a/crates/gipfel-web/src/canvas_view.rs +++ b/crates/gipfel-web/src/canvas_view.rs @@ -51,8 +51,9 @@ pub struct Props { /// bumped on window resize to force a redraw pub tick: u32, pub markers: Vec, - /// projected positions of all visible hills (small guide dots) - pub candidates: Vec<(f64, f64)>, + /// projected positions of all visible hills (guide dots) with their + /// hidden-by-occlusion flag + pub candidates: Vec<(f64, f64, bool)>, /// marker label font size, screen px pub label_font: f32, } @@ -131,10 +132,11 @@ pub fn canvas_view(props: &Props) -> Html { let sy = |y: f64| (y + hh) * view.scale + view.oy; // guide dots for all visible peaks: dark outline ring + - // bright core so they stay visible on any photo content + // bright core so they stay visible on any photo content; + // peaks hidden by nearer terrain are drawn grey #[allow(deprecated)] ctx.set_fill_style(&wasm_bindgen::JsValue::from_str("rgba(0, 0, 0, 0.85)")); - for (cx, cy) in candidates { + for (cx, cy, _hidden) in candidates { let (px, py) = (sx(*cx), sy(*cy)); if px < -6.0 || py < -6.0 || px > cw + 6.0 || py > ch + 6.0 { continue; @@ -143,13 +145,14 @@ pub fn canvas_view(props: &Props) -> Html { let _ = ctx.arc(px, py, 4.5, 0.0, std::f64::consts::TAU); ctx.fill(); } - #[allow(deprecated)] - ctx.set_fill_style(&wasm_bindgen::JsValue::from_str("rgb(110, 231, 183)")); - for (cx, cy) in candidates { + for (cx, cy, hidden) in candidates { let (px, py) = (sx(*cx), sy(*cy)); if px < -6.0 || py < -6.0 || px > cw + 6.0 || py > ch + 6.0 { continue; } + let color = if *hidden { "rgb(150, 150, 150)" } else { "rgb(110, 231, 183)" }; + #[allow(deprecated)] + ctx.set_fill_style(&wasm_bindgen::JsValue::from_str(color)); ctx.begin_path(); let _ = ctx.arc(px, py, 2.5, 0.0, std::f64::consts::TAU); ctx.fill(); -- cgit v1.2.3