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/bridge.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/bridge.rs')
| -rw-r--r-- | crates/gipfel-web/src/bridge.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/crates/gipfel-web/src/bridge.rs b/crates/gipfel-web/src/bridge.rs index a60b1f6..6dbba93 100644 --- a/crates/gipfel-web/src/bridge.rs +++ b/crates/gipfel-web/src/bridge.rs @@ -53,6 +53,13 @@ pub async fn fetch_bytes(url: &str) -> Result<Vec<u8>, String> { Ok(Uint8Array::new(&buf).to_vec()) } +/// setTimeout as an awaitable Promise. +pub fn delay_promise(ms: i32) -> js_sys::Promise { + js_sys::Promise::new(&mut |resolve, _reject| { + let _ = window().set_timeout_with_callback_and_timeout_and_arguments_0(&resolve, ms); + }) +} + pub fn ctx2d(canvas: &HtmlCanvasElement) -> Option<CanvasRenderingContext2d> { canvas .get_context("2d") |
