From 9e1d138a29aafc52d2da68b66f7d6ea00081134f Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Tue, 27 Oct 2026 11:48:04 +0100 Subject: web: visible guide dots with hover peak identification MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - guide dots: dark outline ring + bright core, readable on any photo - hover over a dot shows 'NAME · height m' in the sidebar (same info the desktop hover status line gives) - pointermove doubles as hover report when not dragging --- crates/gipfel-web/src/app.rs | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'crates/gipfel-web/src/app.rs') diff --git a/crates/gipfel-web/src/app.rs b/crates/gipfel-web/src/app.rs index 8512d6a..f152dcc 100644 --- a/crates/gipfel-web/src/app.rs +++ b/crates/gipfel-web/src/app.rs @@ -38,6 +38,7 @@ pub fn app() -> Html { let pan = use_mut_ref(Panorama::new); let markers = use_state(Vec::::new); let fit_distortion = use_state(|| false); + let hover = use_state(|| Option::::None); // force a redraw when the window is resized so the canvas backing // store tracks its CSS size (listener lives as long as the app) @@ -309,6 +310,23 @@ pub fn app() -> Html { } }) }, + hover: { + let pan = pan.clone(); + let view = view.clone(); + let hover = hover.clone(); + Callback::from(move |(ix, iy): (f64, f64)| { + let p = pan.borrow(); + let name = markers::nearest_hill(&p, ix, iy, 20.0 / view.scale).map(|i| { + let h = &p.hills[i]; + format!("{} · {:.0} m", h.name, h.height) + }); + hover.set(name); + }) + }, + hover_end: { + let hover = hover.clone(); + Callback::from(move |_: ()| hover.set(None)) + }, }; // overlay data for the canvas @@ -356,9 +374,12 @@ pub fn app() -> Html { if !fit_info.is_empty() {

{ (*fit_info).clone() }

} + if let Some(h) = hover.as_ref() { +

{ h.clone() }

+ } }

- { "Click a green dot to mark that peak · drag markers to adjust · right-click a marker to remove." } + { "Hover a green dot to see the peak · click to mark it · drag to adjust · right-click to remove." }

{ "The view is fitted automatically once 4+ markers are placed." } -- cgit v1.2.3