summaryrefslogtreecommitdiff
path: root/crates/gipfel-web/src/canvas_view.rs
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2026-10-27 13:41:53 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2026-10-27 13:41:53 +0100
commit0b85e7989eacb26d3496cdb98ed3221868a4013f (patch)
tree41294bfd9a3617950a87ff72a30971fac640e9a0 /crates/gipfel-web/src/canvas_view.rs
parenta436af8b35dacde89ec97e18134b02acf52f159c (diff)
web: hidden-peak heuristics in the UI with Show-hidden toggle
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)
Diffstat (limited to 'crates/gipfel-web/src/canvas_view.rs')
-rw-r--r--crates/gipfel-web/src/canvas_view.rs17
1 files changed, 10 insertions, 7 deletions
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<MarkerView>,
- /// 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();