From 4cdfae6ad5d5f9808ebf3078fb4630298051f464 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Tue, 27 Oct 2026 20:02:23 +0100 Subject: web: GPS paste field in Viewpoint section MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit One text field accepting '47.676,13.32042' (optionally ',alt' as a third component; commas, semicolons or spaces as separators) — the format gallery apps show, so the coordinates can simply be copied and pasted. This replaces the PWA/share-target detour for getting a viewpoint onto mobile: EXIF GPS may be redacted by the OS, but the gallery displays the true coordinates for manual transfer. --- crates/wipfel/src/app.rs | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'crates/wipfel/src/app.rs') diff --git a/crates/wipfel/src/app.rs b/crates/wipfel/src/app.rs index 78961fc..137e121 100644 --- a/crates/wipfel/src/app.rs +++ b/crates/wipfel/src/app.rs @@ -19,7 +19,7 @@ use crate::bridge; use crate::canvas_view::{CanvasView, DotView, MarkerView, TrackView, ViewCallbacks, ViewState}; use crate::compass::{alph_at_img_x, Compass, CompassData}; use crate::markers::{self, Marker}; -use crate::widgets::{NumItem, SliderItem}; +use crate::widgets::{NumItem, SliderItem, TextItem}; /// sidebar-editable view parameters (degrees / meters / mm) #[derive(Clone, Copy, PartialEq)] @@ -548,6 +548,33 @@ pub fn app() -> Html { let on_lat = param_cb!(lat, |p: &mut Panorama, v| p.set_view_lat(v)); let on_lon = param_cb!(lon, |p, v| p.set_view_long(v)); let on_height = param_cb!(height, |p, v| p.set_view_height(v)); + // GPS paste field: "47.676,13.32042" — the format gallery apps show + // for coordinates; height stays a separate field + let on_gps = { + let vp = vp.clone(); + let pan = pan.clone(); + let status = status.clone(); + Callback::from(move |text: String| { + let parts: Vec = text + .replace([';', ' '], ",") + .split(',') + .filter(|p| !p.trim().is_empty()) + .filter_map(|p| p.trim().parse::().ok()) + .collect(); + if parts.len() < 2 || parts[0].abs() > 90.0 || parts[1].abs() > 180.0 { + status.set("GPS: expected \"lat,lon\" like 47.676,13.32042".to_string()); + return; + } + let mut u = *vp; + u.lat = parts[0]; + u.lon = parts[1]; + let mut p = pan.borrow_mut(); + p.set_view_lat(parts[0]); + p.set_view_long(parts[1]); + vp.set(u); + status.set(format!("Viewpoint: {:.5}, {:.5}", parts[0], parts[1])); + }) + }; let on_az = param_cb!(az, |p, v| p.set_center_angle(v)); let on_pitch = param_cb!(pitch, |p, v| p.set_pitch_angle(v)); let on_roll = param_cb!(roll, |p, v| p.set_roll_angle(v)); @@ -929,6 +956,8 @@ pub fn app() -> Html { onchange={on_lon} /> +
{ "Orientation" }
-- cgit v1.2.3