Route panel: points from search, GPS and library points, reordering, editing a saved route
This commit is contained in:
1 parent
3146478c23
commit
abde7fe5f9
10 files changed
+214
-25
No files matched your search
@@ -31,3 +31,25 @@ export function notifyGpxStoreChanged(path) {
|
||||
export function onGpxStoreChanged(callback) {
|
||||
document.addEventListener(STORE_CHANGED_EVENT, (event) => callback(event.detail));
|
||||
}
|
||||
|
||||
// Anything with a location (a search result, a library point) hands it to
|
||||
// the route panel (route.js) the same decoupled way.
|
||||
const ROUTE_POINT_EVENT = "route-point";
|
||||
const ROUTE_EDIT_EVENT = "route-edit";
|
||||
|
||||
export function addRoutePoint(lngLat, name) {
|
||||
document.dispatchEvent(new CustomEvent(ROUTE_POINT_EVENT, { detail: { lngLat, name } }));
|
||||
}
|
||||
|
||||
export function onRoutePoint(callback) {
|
||||
document.addEventListener(ROUTE_POINT_EVENT, (event) => callback(event.detail));
|
||||
}
|
||||
|
||||
// A saved route (its library node key and feature) back into the panel.
|
||||
export function editRoute(key, feature) {
|
||||
document.dispatchEvent(new CustomEvent(ROUTE_EDIT_EVENT, { detail: { key, feature } }));
|
||||
}
|
||||
|
||||
export function onRouteEdit(callback) {
|
||||
document.addEventListener(ROUTE_EDIT_EVENT, (event) => callback(event.detail));
|
||||
}
|
||||
Reference in new issue
Block a user