diff options
| author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2026-10-27 12:20:55 +0100 |
|---|---|---|
| committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2026-10-27 12:20:55 +0100 |
| commit | 82c0414f66f4998c3d61764a1c504e06e62e7ab0 (patch) | |
| tree | ef9198a9836a21e9ef043ea12e1561ec34f9f868 /crates/gipfel-web/src/widgets.rs | |
| parent | 70784357c804d3411bb93fa6e0a74c9ffcd3d3ad (diff) | |
web: Find Peak dialog, live sliders, graduated fit, load-race fix
- click away from a dot now opens a Find Peak list (candidates within
60 px, sorted by distance, name/height/pixel-offset labels) — the
desktop dialog equivalent for crowded ridgelines
- sliders update on input, not on release
- fit is graduated like the original: 1 marker fits the center angle,
2 add scale, 4+ the full viewpoint (removed the >=4 gate)
- image load now re-fits once more 120 ms after the first paint
(same nudge as the desktop app) so the picture never stays hidden
Diffstat (limited to 'crates/gipfel-web/src/widgets.rs')
| -rw-r--r-- | crates/gipfel-web/src/widgets.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/crates/gipfel-web/src/widgets.rs b/crates/gipfel-web/src/widgets.rs index f93f424..1d22bac 100644 --- a/crates/gipfel-web/src/widgets.rs +++ b/crates/gipfel-web/src/widgets.rs @@ -1,7 +1,7 @@ //! Small form controls: full-width slider with value readout above //! (mirrors the desktop `slider_item` layout) and a numeric input row. -use web_sys::HtmlInputElement; +use web_sys::{HtmlInputElement, InputEvent}; use yew::prelude::*; #[derive(Properties, PartialEq)] @@ -18,9 +18,10 @@ pub struct SliderProps { #[function_component(SliderItem)] pub fn slider_item(p: &SliderProps) -> Html { - let onchange = { + // live update while dragging (oninput), not only on release + let oninput = { let onchange = p.onchange.clone(); - Callback::from(move |e: Event| { + Callback::from(move |e: InputEvent| { let input: HtmlInputElement = e.target_unchecked_into(); if let Ok(v) = input.value().parse::<f64>() { onchange.emit(v); @@ -39,7 +40,7 @@ pub fn slider_item(p: &SliderProps) -> Html { max={p.max.to_string()} step={p.step.to_string()} value={p.value.to_string()} - {onchange} + {oninput} /> </div> } |
