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,
|
2024-06-20 18:13:46 +02:00
|
|
|
maxWidth: undefined,
|
|
|
|
offset: {
|
|
|
|
'top': [0, 0],
|
|
|
|
'top-left': [0, 0],
|
|
|
|
'top-right': [0, 0],
|
|
|
|
'bottom': [0, -30],
|
|
|
|
'bottom-left': [0, -30],
|
|
|
|
'bottom-right': [0, -30],
|
|
|
|
'left': [0, 0],
|
|
|
|
'right': [0, 0]
|
|
|
|
},
|
2024-06-13 09:44:27 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
export function deleteWaypoint(fileId: string, waypointIndex: number) {
|
2024-07-04 02:17:50 +02:00
|
|
|
dbUtils.applyToFile(fileId, (file) => file.replaceWaypoints(waypointIndex, waypointIndex, []));
|
2024-06-13 09:44:27 +02:00
|
|
|
}
|