mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-09-02 16:52:31 +00:00
store settings
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
import type { Coordinates } from "gpx";
|
||||
import { TrackPoint } from "gpx";
|
||||
import { get, writable } from "svelte/store";
|
||||
import { settings } from "$lib/db";
|
||||
import { _ } from "svelte-i18n";
|
||||
|
||||
const { routing, routingProfile, privateRoads } = settings;
|
||||
|
||||
export const brouterProfiles: { [key: string]: string } = {
|
||||
bike: 'Trekking-dry',
|
||||
racing_bike: 'fastbike',
|
||||
@@ -12,12 +15,24 @@ export const brouterProfiles: { [key: string]: string } = {
|
||||
water: 'river',
|
||||
railway: 'rail'
|
||||
};
|
||||
export const routingProfile = writable({
|
||||
export const routingProfileSelectItem = writable({
|
||||
value: 'bike',
|
||||
label: get(_)('toolbar.routing.activities.bike')
|
||||
});
|
||||
export const routing = writable(true);
|
||||
export const privateRoads = writable(false);
|
||||
routingProfile.subscribe((value) => {
|
||||
if (value !== get(routingProfileSelectItem).value) {
|
||||
routingProfileSelectItem.update((item) => {
|
||||
item.value = value;
|
||||
item.label = get(_)(`toolbar.routing.activities.${value}`);
|
||||
return item;
|
||||
});
|
||||
}
|
||||
});
|
||||
routingProfileSelectItem.subscribe((item) => {
|
||||
if (item.value !== get(routingProfile)) {
|
||||
routingProfile.set(item.value);
|
||||
}
|
||||
});
|
||||
|
||||
export function route(points: Coordinates[]): Promise<TrackPoint[]> {
|
||||
if (get(routing)) {
|
||||
|
Reference in New Issue
Block a user