mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2026-10-10 07:36:29 +00:00
fix link fields
This commit is contained in:
1 parent
42a55e6759
commit
83b76bb838
14 files changed
+345
-79
No files matched your search
@@ -143,13 +143,19 @@ pub fn waypoint(file_id: &str, waypoint_id: &str) -> WaypointDetails {
|
||||
set(&object, key, value.as_str());
|
||||
}
|
||||
}
|
||||
if let Some(link) = &wpt.link {
|
||||
let link_object = Object::new();
|
||||
set(&link_object, "href", link.href.as_str());
|
||||
if let Some(text) = &link.text {
|
||||
set(&link_object, "text", text.as_str());
|
||||
}
|
||||
set(&object, "link", link_object);
|
||||
if !wpt.links.is_empty() {
|
||||
set(
|
||||
&object,
|
||||
"links",
|
||||
array(&wpt.links, |link| {
|
||||
let link_object = Object::new();
|
||||
set(&link_object, "href", link.href.as_str());
|
||||
if let Some(text) = &link.text {
|
||||
set(&link_object, "text", text.as_str());
|
||||
}
|
||||
link_object.into()
|
||||
}),
|
||||
);
|
||||
}
|
||||
JsValue::from(object)
|
||||
})
|
||||
|
||||
@@ -52,7 +52,8 @@ export interface WaypointDetails {
|
||||
name?: string;
|
||||
desc?: string;
|
||||
cmt?: string;
|
||||
link?: { href: string; text?: string };
|
||||
/** The links of the waypoint, absent when it has none. */
|
||||
links?: { href: string; text?: string }[];
|
||||
sym?: string;
|
||||
}
|
||||
/** The position, elevation and time of a trackpoint. */
|
||||
|
||||
Reference in new issue
Block a user