diff options
| author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2026-10-27 13:41:53 +0100 |
|---|---|---|
| committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2026-10-27 13:41:53 +0100 |
| commit | 0b85e7989eacb26d3496cdb98ed3221868a4013f (patch) | |
| tree | 41294bfd9a3617950a87ff72a30971fac640e9a0 /crates/gipfel-web/src/markers.rs | |
| parent | a436af8b35dacde89ec97e18134b02acf52f159c (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/markers.rs')
| -rw-r--r-- | crates/gipfel-web/src/markers.rs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/crates/gipfel-web/src/markers.rs b/crates/gipfel-web/src/markers.rs index d1bf8cb..d024f2e 100644 --- a/crates/gipfel-web/src/markers.rs +++ b/crates/gipfel-web/src/markers.rs @@ -34,11 +34,21 @@ pub fn refit(pan: &mut Panorama, markers: &[Marker], fit_distortion: bool) -> Re } /// Nearest visible hill to image position `(x, y)`, within `max_dist` -/// image pixels. Used to resolve marker clicks. -pub fn nearest_hill(pan: &Panorama, x: f64, y: f64, max_dist: f64) -> Option<usize> { +/// image pixels. Used to resolve marker clicks. Hills hidden by the +/// occlusion heuristic are skipped unless `show_hidden`. +pub fn nearest_hill( + pan: &Panorama, + x: f64, + y: f64, + max_dist: f64, + show_hidden: bool, +) -> Option<usize> { let mut best = None; let mut best_d = max_dist; for &i in &pan.visible { + if !show_hidden && pan.hills[i].flags & gipfel_core::hill::FLAG_HIDDEN != 0 { + continue; + } let h = &pan.hills[i]; let d = (h.x - x).hypot(h.y - y); if d < best_d { |
