Files
gpx.studio/website/src/lib/components/gpx-layer/WaypointPopup.ts

15 lines
507 B
TypeScript
Raw Normal View History

2024-06-13 09:44:27 +02:00
import { dbUtils } from "$lib/db";
2024-05-13 19:43:10 +02:00
import type { Waypoint } from "gpx";
import mapboxgl from "mapbox-gl";
import { writable } from "svelte/store";
2024-06-13 09:44:27 +02:00
export const currentPopupWaypoint = writable<[Waypoint, string] | null>(null);
2024-05-13 19:43:10 +02:00
export const waypointPopup = new mapboxgl.Popup({
closeButton: false,
maxWidth: undefined
2024-06-13 09:44:27 +02:00
});
export function deleteWaypoint(fileId: string, waypointIndex: number) {
dbUtils.applyToFile(fileId, (file) => file.replaceWaypoints(waypointIndex, waypointIndex, [])[0]);
}