delete waypoint

This commit is contained in:
vcoppe
2024-06-13 09:44:27 +02:00
parent a0eefb9e58
commit 9132a45798
4 changed files with 68 additions and 25 deletions

View File

@@ -1,10 +1,15 @@
import { dbUtils } from "$lib/db";
import type { Waypoint } from "gpx";
import mapboxgl from "mapbox-gl";
import { writable } from "svelte/store";
export const currentPopupWaypoint = writable<Waypoint | null>(null);
export const currentPopupWaypoint = writable<[Waypoint, string] | null>(null);
export const waypointPopup = new mapboxgl.Popup({
closeButton: false,
maxWidth: undefined
});
});
export function deleteWaypoint(fileId: string, waypointIndex: number) {
dbUtils.applyToFile(fileId, (file) => file.replaceWaypoints(waypointIndex, waypointIndex, [])[0]);
}