summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2026-10-27 20:02:23 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2026-10-27 20:03:12 +0100
commit4cdfae6ad5d5f9808ebf3078fb4630298051f464 (patch)
tree9b982284a809831b812797ed8876d211c4c70ae3
parentb084d94e484aa057cc839892c6e49df3caf8a0e6 (diff)
web: GPS paste field in Viewpoint section
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.
-rw-r--r--crates/wipfel/src/app.rs31
-rw-r--r--crates/wipfel/src/widgets.rs29
-rw-r--r--crates/wipfel/www/style.css3
-rw-r--r--dist/wipfel/style.css3
-rw-r--r--dist/wipfel/wipfel.js6
-rw-r--r--dist/wipfel/wipfel_bg.wasmbin511473 -> 517699 bytes
6 files changed, 68 insertions, 4 deletions
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<f64> = text
+ .replace([';', ' '], ",")
+ .split(',')
+ .filter(|p| !p.trim().is_empty())
+ .filter_map(|p| p.trim().parse::<f64>().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} />
<NumItem label="Height (m)" value={vp.height} step={1.0} decimals={0}
onchange={on_height} />
+ <TextItem label="GPS paste" placeholder="47.676,13.32042"
+ onchange={on_gps} />
<div class="section">{ "Orientation" }</div>
<SliderItem label="Azimuth" display={format!("{:.1}°", vp.az)}
value={vp.az} min={0.0} max={360.0} step={0.01} onchange={on_az} />
diff --git a/crates/wipfel/src/widgets.rs b/crates/wipfel/src/widgets.rs
index 1d22bac..93e2cdc 100644
--- a/crates/wipfel/src/widgets.rs
+++ b/crates/wipfel/src/widgets.rs
@@ -46,6 +46,35 @@ pub fn slider_item(p: &SliderProps) -> Html {
}
}
+/// single-line text row (e.g. paste a GPS string)
+#[derive(Properties, PartialEq)]
+pub struct TextProps {
+ pub label: AttrValue,
+ pub placeholder: AttrValue,
+ pub onchange: Callback<String>,
+}
+
+#[function_component(TextItem)]
+pub fn text_item(p: &TextProps) -> Html {
+ let onchange = {
+ let onchange = p.onchange.clone();
+ Callback::from(move |e: Event| {
+ let input: HtmlInputElement = e.target_unchecked_into();
+ onchange.emit(input.value());
+ })
+ };
+ html! {
+ <label class="numrow">
+ <span>{ p.label.as_ref().to_string() }</span>
+ <input
+ type="text"
+ placeholder={p.placeholder.as_ref().to_string()}
+ {onchange}
+ />
+ </label>
+ }
+}
+
#[derive(Properties, PartialEq)]
pub struct NumProps {
pub label: AttrValue,
diff --git a/crates/wipfel/www/style.css b/crates/wipfel/www/style.css
index 646444d..79e2dee 100644
--- a/crates/wipfel/www/style.css
+++ b/crates/wipfel/www/style.css
@@ -216,6 +216,9 @@ canvas.compass {
border: 1px solid #34343e;
border-radius: 4px;
}
+.numrow input[type="text"] {
+ width: 150px;
+}
.fpbackdrop {
position: absolute;
inset: 0;
diff --git a/dist/wipfel/style.css b/dist/wipfel/style.css
index 646444d..79e2dee 100644
--- a/dist/wipfel/style.css
+++ b/dist/wipfel/style.css
@@ -216,6 +216,9 @@ canvas.compass {
border: 1px solid #34343e;
border-radius: 4px;
}
+.numrow input[type="text"] {
+ width: 150px;
+}
.fpbackdrop {
position: absolute;
inset: 0;
diff --git a/dist/wipfel/wipfel.js b/dist/wipfel/wipfel.js
index e1eedc0..648289c 100644
--- a/dist/wipfel/wipfel.js
+++ b/dist/wipfel/wipfel.js
@@ -600,12 +600,12 @@ function __wbg_get_imports() {
return ret;
},
__wbindgen_generic_0000000000000001: function(arg0, arg1) {
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 47, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 48, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_f1f668f83a5f514b___convert__closures_____invoke___wasm_bindgen_f1f668f83a5f514b___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_f1f668f83a5f514b___JsError___true_);
return ret;
},
__wbindgen_generic_0000000000000002: function(arg0, arg1) {
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Array<any>"), NamedExternref("ResizeObserver")], shim_idx: 75, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Array<any>"), NamedExternref("ResizeObserver")], shim_idx: 74, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
const ret = makeClosure(arg0, arg1, wasm_bindgen_f1f668f83a5f514b___convert__closures_____invoke___js_sys_351dd7d36d5f7033___Array__web_sys_d6718dd818f67bd6___features__gen_ResizeObserver__ResizeObserver______true_);
return ret;
},
@@ -615,7 +615,7 @@ function __wbg_get_imports() {
return ret;
},
__wbindgen_generic_0000000000000004: function(arg0, arg1) {
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 77, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 76, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
const ret = makeClosure(arg0, arg1, wasm_bindgen_f1f668f83a5f514b___convert__closures_____invoke_______true_);
return ret;
},
diff --git a/dist/wipfel/wipfel_bg.wasm b/dist/wipfel/wipfel_bg.wasm
index 3b906d2..54e6444 100644
--- a/dist/wipfel/wipfel_bg.wasm
+++ b/dist/wipfel/wipfel_bg.wasm
Binary files differ