mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-09-01 08:12:32 +00:00
refactoring for tools and start waypoint
This commit is contained in:
@@ -567,6 +567,14 @@ export class Waypoint {
|
|||||||
this.sym = waypoint.sym;
|
this.sym = waypoint.sym;
|
||||||
this.type = waypoint.type;
|
this.type = waypoint.type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getCoordinates(): Coordinates {
|
||||||
|
return this.attributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
setCoordinates(coordinates: Coordinates): void {
|
||||||
|
this.attributes = coordinates;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GPXStatistics {
|
export class GPXStatistics {
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import type { GPXFile } from "gpx";
|
import type { GPXFile, Waypoint } from "gpx";
|
||||||
import { map, selectFiles, currentTool, Tool } from "$lib/stores";
|
import { map, selectFiles, currentTool, Tool } from "$lib/stores";
|
||||||
import { get, type Writable } from "svelte/store";
|
import { get, type Writable } from "svelte/store";
|
||||||
import type mapboxgl from "mapbox-gl";
|
import mapboxgl from "mapbox-gl";
|
||||||
|
|
||||||
let id = 0;
|
let id = 0;
|
||||||
function getLayerId() {
|
function getLayerId() {
|
||||||
@@ -46,16 +46,21 @@ export class GPXLayer {
|
|||||||
file: Writable<GPXFile>;
|
file: Writable<GPXFile>;
|
||||||
layerId: string;
|
layerId: string;
|
||||||
layerColor: string;
|
layerColor: string;
|
||||||
|
popup: mapboxgl.Popup;
|
||||||
|
popupElement: HTMLElement;
|
||||||
|
markers: mapboxgl.Marker[] = [];
|
||||||
unsubscribe: () => void;
|
unsubscribe: () => void;
|
||||||
|
|
||||||
addBinded: () => void = this.add.bind(this);
|
addBinded: () => void = this.add.bind(this);
|
||||||
selectOnClickBinded: (e: any) => void = this.selectOnClick.bind(this);
|
selectOnClickBinded: (e: any) => void = this.selectOnClick.bind(this);
|
||||||
|
|
||||||
constructor(map: mapboxgl.Map, file: Writable<GPXFile>) {
|
constructor(map: mapboxgl.Map, file: Writable<GPXFile>, popup: mapboxgl.Popup, popupElement: HTMLElement) {
|
||||||
this.map = map;
|
this.map = map;
|
||||||
this.file = file;
|
this.file = file;
|
||||||
this.layerId = getLayerId();
|
this.layerId = getLayerId();
|
||||||
this.layerColor = getColor();
|
this.layerColor = getColor();
|
||||||
|
this.popup = popup;
|
||||||
|
this.popupElement = popupElement;
|
||||||
this.unsubscribe = file.subscribe(this.updateData.bind(this));
|
this.unsubscribe = file.subscribe(this.updateData.bind(this));
|
||||||
|
|
||||||
get(this.file)._data = {
|
get(this.file)._data = {
|
||||||
@@ -97,6 +102,23 @@ export class GPXLayer {
|
|||||||
this.map.on('mouseenter', this.layerId, toPointerCursor);
|
this.map.on('mouseenter', this.layerId, toPointerCursor);
|
||||||
this.map.on('mouseleave', this.layerId, toDefaultCursor);
|
this.map.on('mouseleave', this.layerId, toDefaultCursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.markers.length == 0) {
|
||||||
|
get(this.file).wpt.forEach((waypoint) => {
|
||||||
|
let marker = new mapboxgl.Marker().setLngLat(waypoint.getCoordinates());
|
||||||
|
marker.getElement().addEventListener('click', (e) => {
|
||||||
|
marker.setPopup(this.popup);
|
||||||
|
marker.togglePopup();
|
||||||
|
e.stopPropagation();
|
||||||
|
});
|
||||||
|
|
||||||
|
this.markers.push(marker);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
this.markers.forEach((marker) => {
|
||||||
|
marker.addTo(this.map);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
updateData() {
|
updateData() {
|
||||||
@@ -115,6 +137,10 @@ export class GPXLayer {
|
|||||||
this.map.removeLayer(this.layerId);
|
this.map.removeLayer(this.layerId);
|
||||||
this.map.removeSource(this.layerId);
|
this.map.removeSource(this.layerId);
|
||||||
|
|
||||||
|
this.markers.forEach((marker) => {
|
||||||
|
marker.remove();
|
||||||
|
});
|
||||||
|
|
||||||
this.unsubscribe();
|
this.unsubscribe();
|
||||||
|
|
||||||
decrementColor(this.layerColor);
|
decrementColor(this.layerColor);
|
||||||
|
@@ -1,31 +1,48 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { map, files, selectedFiles, getFileStore } from '$lib/stores';
|
import { map, files, selectedFiles, getFileStore, gpxLayers } from '$lib/stores';
|
||||||
import type { GPXFile } from 'gpx';
|
|
||||||
import { GPXLayer } from './GPXLayer';
|
import { GPXLayer } from './GPXLayer';
|
||||||
import { get, type Writable } from 'svelte/store';
|
import { get } from 'svelte/store';
|
||||||
|
import { onMount } from 'svelte';
|
||||||
|
import mapboxgl from 'mapbox-gl';
|
||||||
|
import WaypointPopup from './WaypointPopup.svelte';
|
||||||
|
|
||||||
let gpxLayers: Map<Writable<GPXFile>, GPXLayer> = new Map();
|
let popupElement: HTMLElement;
|
||||||
|
let popup: mapboxgl.Popup | null = null;
|
||||||
|
|
||||||
$: if ($map) {
|
$: if ($map) {
|
||||||
// remove layers for deleted files
|
gpxLayers.update(($layers) => {
|
||||||
gpxLayers.forEach((layer, file) => {
|
// remove layers for deleted files
|
||||||
if (!get(files).includes(file)) {
|
$layers.forEach((layer, file) => {
|
||||||
layer.remove();
|
if (!get(files).includes(file)) {
|
||||||
gpxLayers.delete(file);
|
layer.remove();
|
||||||
}
|
$layers.delete(file);
|
||||||
});
|
}
|
||||||
// add layers for new files
|
});
|
||||||
$files.forEach((file) => {
|
// add layers for new files
|
||||||
if (!gpxLayers.has(file)) {
|
$files.forEach((file) => {
|
||||||
gpxLayers.set(file, new GPXLayer(get(map), file));
|
if (!$layers.has(file)) {
|
||||||
}
|
$layers.set(file, new GPXLayer(get(map), file, popup, popupElement));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return $layers;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$: $selectedFiles.forEach((file) => {
|
$: $selectedFiles.forEach((file) => {
|
||||||
let fileStore = getFileStore(file);
|
let fileStore = getFileStore(file);
|
||||||
if (gpxLayers.has(fileStore)) {
|
if ($gpxLayers.has(fileStore)) {
|
||||||
gpxLayers.get(fileStore)?.moveToFront();
|
$gpxLayers.get(fileStore)?.moveToFront();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
popup = new mapboxgl.Popup({
|
||||||
|
closeButton: false,
|
||||||
|
maxWidth: undefined
|
||||||
|
});
|
||||||
|
popup.setDOMContent(popupElement);
|
||||||
|
popupElement.classList.remove('hidden');
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<WaypointPopup bind:element={popupElement} />
|
||||||
|
13
website/src/lib/components/gpx-layer/WaypointPopup.svelte
Normal file
13
website/src/lib/components/gpx-layer/WaypointPopup.svelte
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import * as Card from '$lib/components/ui/card';
|
||||||
|
|
||||||
|
import { _ } from 'svelte-i18n';
|
||||||
|
|
||||||
|
export let element: HTMLElement;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div bind:this={element} class="hidden">
|
||||||
|
<Card.Root class="border-none shadow-md text-base">
|
||||||
|
<Card.Content class="flex flex-col p-1">Waypoint info (TODO)</Card.Content>
|
||||||
|
</Card.Root>
|
||||||
|
</div>
|
@@ -1,6 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { currentTool, reverseSelectedFiles, Tool } from '$lib/stores';
|
import { reverseSelectedFiles, Tool } from '$lib/stores';
|
||||||
import Routing from '$lib/components/routing/Routing.svelte';
|
import Routing from '$lib/components/toolbar/tools/routing/Routing.svelte';
|
||||||
|
import Waypoint from '$lib/components/toolbar/tools/waypoint/Waypoint.svelte';
|
||||||
import ToolbarItem from './ToolbarItem.svelte';
|
import ToolbarItem from './ToolbarItem.svelte';
|
||||||
import {
|
import {
|
||||||
ArrowRightLeft,
|
ArrowRightLeft,
|
||||||
@@ -16,14 +17,6 @@
|
|||||||
} from 'lucide-svelte';
|
} from 'lucide-svelte';
|
||||||
|
|
||||||
import { _ } from 'svelte-i18n';
|
import { _ } from 'svelte-i18n';
|
||||||
|
|
||||||
function getToggleTool(tool: Tool) {
|
|
||||||
return () => toggleTool(tool);
|
|
||||||
}
|
|
||||||
|
|
||||||
function toggleTool(tool: Tool) {
|
|
||||||
currentTool.update((current) => (current === tool ? null : tool));
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="absolute top-0 bottom-0 left-0 z-20 flex flex-col justify-center pointer-events-none">
|
<div class="absolute top-0 bottom-0 left-0 z-20 flex flex-col justify-center pointer-events-none">
|
||||||
@@ -31,47 +24,48 @@
|
|||||||
<div
|
<div
|
||||||
class="h-fit flex flex-col p-1 gap-1 bg-background rounded-md pointer-events-auto shadow-md"
|
class="h-fit flex flex-col p-1 gap-1 bg-background rounded-md pointer-events-auto shadow-md"
|
||||||
>
|
>
|
||||||
<ToolbarItem on:click={getToggleTool(Tool.ROUTING)}>
|
<ToolbarItem tool={Tool.ROUTING}>
|
||||||
<Pencil slot="icon" size="18" />
|
<Pencil slot="icon" size="18" />
|
||||||
<span slot="tooltip">{$_('toolbar.routing.tooltip')}</span>
|
<span slot="tooltip">{$_('toolbar.routing.tooltip')}</span>
|
||||||
</ToolbarItem>
|
</ToolbarItem>
|
||||||
<ToolbarItem>
|
<ToolbarItem tool={Tool.TIME}>
|
||||||
<CalendarClock slot="icon" size="18" />
|
<CalendarClock slot="icon" size="18" />
|
||||||
<span slot="tooltip">{$_('toolbar.time_tooltip')}</span>
|
<span slot="tooltip">{$_('toolbar.time_tooltip')}</span>
|
||||||
</ToolbarItem>
|
</ToolbarItem>
|
||||||
<ToolbarItem on:click={reverseSelectedFiles}>
|
<ToolbarItem tool={Tool.REVERSE} on:click={reverseSelectedFiles}>
|
||||||
<ArrowRightLeft slot="icon" size="18" />
|
<ArrowRightLeft slot="icon" size="18" />
|
||||||
<span slot="tooltip">{$_('toolbar.reverse_tooltip')}</span>
|
<span slot="tooltip">{$_('toolbar.reverse_tooltip')}</span>
|
||||||
</ToolbarItem>
|
</ToolbarItem>
|
||||||
<ToolbarItem>
|
<ToolbarItem tool={Tool.MERGE}>
|
||||||
<Group slot="icon" size="18" />
|
<Group slot="icon" size="18" />
|
||||||
<span slot="tooltip">{$_('toolbar.merge_tooltip')}</span>
|
<span slot="tooltip">{$_('toolbar.merge_tooltip')}</span>
|
||||||
</ToolbarItem>
|
</ToolbarItem>
|
||||||
<ToolbarItem>
|
<ToolbarItem tool={Tool.EXTRACT}>
|
||||||
<Ungroup slot="icon" size="18" />
|
<Ungroup slot="icon" size="18" />
|
||||||
<span slot="tooltip">{$_('toolbar.extract_tooltip')}</span>
|
<span slot="tooltip">{$_('toolbar.extract_tooltip')}</span>
|
||||||
</ToolbarItem>
|
</ToolbarItem>
|
||||||
<ToolbarItem>
|
<ToolbarItem tool={Tool.WAYPOINT}>
|
||||||
<MapPin slot="icon" size="18" />
|
<MapPin slot="icon" size="18" />
|
||||||
<span slot="tooltip">{$_('toolbar.waypoint_tooltip')}</span>
|
<span slot="tooltip">{$_('toolbar.waypoint_tooltip')}</span>
|
||||||
</ToolbarItem>
|
</ToolbarItem>
|
||||||
<ToolbarItem>
|
<ToolbarItem tool={Tool.REDUCE}>
|
||||||
<Shrink slot="icon" size="18" />
|
<Shrink slot="icon" size="18" />
|
||||||
<span slot="tooltip">{$_('toolbar.reduce_tooltip')}</span>
|
<span slot="tooltip">{$_('toolbar.reduce_tooltip')}</span>
|
||||||
</ToolbarItem>
|
</ToolbarItem>
|
||||||
<ToolbarItem>
|
<ToolbarItem tool={Tool.CLEAN}>
|
||||||
<SquareDashedMousePointer slot="icon" size="18" />
|
<SquareDashedMousePointer slot="icon" size="18" />
|
||||||
<span slot="tooltip">{$_('toolbar.clean_tooltip')}</span>
|
<span slot="tooltip">{$_('toolbar.clean_tooltip')}</span>
|
||||||
</ToolbarItem>
|
</ToolbarItem>
|
||||||
<ToolbarItem>
|
<ToolbarItem tool={Tool.STYLE}>
|
||||||
<Palette slot="icon" size="18" />
|
<Palette slot="icon" size="18" />
|
||||||
<span slot="tooltip">{$_('toolbar.style_tooltip')}</span>
|
<span slot="tooltip">{$_('toolbar.style_tooltip')}</span>
|
||||||
</ToolbarItem>
|
</ToolbarItem>
|
||||||
<ToolbarItem>
|
<ToolbarItem tool={Tool.STRUCTURE}>
|
||||||
<FolderTree slot="icon" size="18" />
|
<FolderTree slot="icon" size="18" />
|
||||||
<span slot="tooltip">{$_('toolbar.structure_tooltip')}</span>
|
<span slot="tooltip">{$_('toolbar.structure_tooltip')}</span>
|
||||||
</ToolbarItem>
|
</ToolbarItem>
|
||||||
</div>
|
</div>
|
||||||
<Routing />
|
<Routing />
|
||||||
|
<Waypoint />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1,11 +1,23 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Button } from '$lib/components/ui/button';
|
import { Button } from '$lib/components/ui/button';
|
||||||
import * as Tooltip from '$lib/components/ui/tooltip/index.js';
|
import * as Tooltip from '$lib/components/ui/tooltip/index.js';
|
||||||
|
import { currentTool, type Tool } from '$lib/stores';
|
||||||
|
|
||||||
|
export let tool: Tool;
|
||||||
|
|
||||||
|
function toggleTool() {
|
||||||
|
currentTool.update((current) => (current === tool ? null : tool));
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Tooltip.Root openDelay={300}>
|
<Tooltip.Root openDelay={300}>
|
||||||
<Tooltip.Trigger asChild let:builder>
|
<Tooltip.Trigger asChild let:builder>
|
||||||
<Button builders={[builder]} variant="ghost" class="h-fit px-1 py-1.5" on:click>
|
<Button
|
||||||
|
builders={[builder]}
|
||||||
|
variant="ghost"
|
||||||
|
class="h-fit px-1 py-1.5 {$currentTool === tool ? 'bg-accent' : ''}"
|
||||||
|
on:click={toggleTool}
|
||||||
|
>
|
||||||
<slot name="icon" />
|
<slot name="icon" />
|
||||||
</Button>
|
</Button>
|
||||||
</Tooltip.Trigger>
|
</Tooltip.Trigger>
|
||||||
|
@@ -1,9 +1,22 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { type Tool, currentTool } from '$lib/stores';
|
||||||
import { flyAndScale } from '$lib/utils';
|
import { flyAndScale } from '$lib/utils';
|
||||||
|
import * as Card from '$lib/components/ui/card';
|
||||||
|
|
||||||
|
export let tool: Tool;
|
||||||
|
export let active = false;
|
||||||
|
|
||||||
|
$: active = $currentTool === tool;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div in:flyAndScale={{ x: -2, y: 0, duration: 100 }} class="translate-x-1 h-full">
|
{#if active}
|
||||||
<div class="rounded-md shadow-md pointer-events-auto">
|
<div in:flyAndScale={{ x: -2, y: 0, duration: 100 }} class="translate-x-1 h-full">
|
||||||
<slot />
|
<div class="rounded-md shadow-md pointer-events-auto">
|
||||||
|
<Card.Root class="border-none">
|
||||||
|
<Card.Content class="p-4 flex flex-col gap-4">
|
||||||
|
<slot />
|
||||||
|
</Card.Content>
|
||||||
|
</Card.Root>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{/if}
|
||||||
|
@@ -1,13 +1,12 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import ToolbarItemMenu from '$lib/components/toolbar/ToolbarItemMenu.svelte';
|
import ToolbarItemMenu from '$lib/components/toolbar/ToolbarItemMenu.svelte';
|
||||||
import * as Card from '$lib/components/ui/card';
|
|
||||||
import * as Select from '$lib/components/ui/select';
|
import * as Select from '$lib/components/ui/select';
|
||||||
import { Switch } from '$lib/components/ui/switch';
|
import { Switch } from '$lib/components/ui/switch';
|
||||||
import { Label } from '$lib/components/ui/label/index.js';
|
import { Label } from '$lib/components/ui/label/index.js';
|
||||||
import * as Alert from '$lib/components/ui/alert';
|
import * as Alert from '$lib/components/ui/alert';
|
||||||
import { CircleHelp } from 'lucide-svelte';
|
import { CircleHelp } from 'lucide-svelte';
|
||||||
|
|
||||||
import { currentTool, files, getFileStore, map, selectedFiles, Tool } from '$lib/stores';
|
import { files, getFileStore, map, selectedFiles, Tool } from '$lib/stores';
|
||||||
import { brouterProfiles, privateRoads, routing, routingProfile } from './Routing';
|
import { brouterProfiles, privateRoads, routing, routingProfile } from './Routing';
|
||||||
|
|
||||||
import { _ } from 'svelte-i18n';
|
import { _ } from 'svelte-i18n';
|
||||||
@@ -34,8 +33,6 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$: active = $currentTool === Tool.ROUTING;
|
|
||||||
|
|
||||||
$: if ($map && $selectedFiles) {
|
$: if ($map && $selectedFiles) {
|
||||||
// update selected file
|
// update selected file
|
||||||
if ($selectedFiles.size == 0 || $selectedFiles.size > 1 || !active) {
|
if ($selectedFiles.size == 0 || $selectedFiles.size > 1 || !active) {
|
||||||
@@ -76,49 +73,40 @@
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if active}
|
<ToolbarItemMenu tool={Tool.ROUTING} bind:active>
|
||||||
<ToolbarItemMenu>
|
<div class="w-full flex flex-row justify-between items-center gap-2">
|
||||||
<Card.Root class="border-none">
|
<Label>{$_('toolbar.routing.activity')}</Label>
|
||||||
<Card.Content class="p-4 flex flex-col gap-4">
|
<Select.Root bind:selected={$routingProfile}>
|
||||||
<div class="w-full flex flex-row justify-between items-center gap-2">
|
<Select.Trigger class="h-8 w-40">
|
||||||
<Label>{$_('toolbar.routing.activity')}</Label>
|
<Select.Value />
|
||||||
<Select.Root bind:selected={$routingProfile}>
|
</Select.Trigger>
|
||||||
<Select.Trigger class="h-8 w-40">
|
<Select.Content>
|
||||||
<Select.Value />
|
{#each Object.keys(brouterProfiles) as profile}
|
||||||
</Select.Trigger>
|
<Select.Item value={profile}>{$_(`toolbar.routing.activities.${profile}`)}</Select.Item>
|
||||||
<Select.Content>
|
{/each}
|
||||||
{#each Object.keys(brouterProfiles) as profile}
|
</Select.Content>
|
||||||
<Select.Item value={profile}
|
</Select.Root>
|
||||||
>{$_(`toolbar.routing.activities.${profile}`)}</Select.Item
|
</div>
|
||||||
>
|
<div class="w-full flex flex-row justify-between items-center gap-2">
|
||||||
{/each}
|
<Label for="routing">{$_('toolbar.routing.use_routing')}</Label>
|
||||||
</Select.Content>
|
<Switch id="routing" class="scale-90" bind:checked={$routing} />
|
||||||
</Select.Root>
|
</div>
|
||||||
</div>
|
<div class="w-full flex flex-row justify-between items-center gap-2">
|
||||||
<div class="w-full flex flex-row justify-between items-center gap-2">
|
<Label for="private">{$_('toolbar.routing.allow_private')}</Label>
|
||||||
<Label for="routing">{$_('toolbar.routing.use_routing')}</Label>
|
<Switch id="private" class="scale-90" bind:checked={$privateRoads} />
|
||||||
<Switch id="routing" class="scale-90" bind:checked={$routing} />
|
</div>
|
||||||
</div>
|
<Alert.Root class="max-w-64">
|
||||||
<div class="w-full flex flex-row justify-between items-center gap-2">
|
<CircleHelp size="16" />
|
||||||
<Label for="private">{$_('toolbar.routing.allow_private')}</Label>
|
<Alert.Description>
|
||||||
<Switch id="private" class="scale-90" bind:checked={$privateRoads} />
|
{#if $selectedFiles.size > 1}
|
||||||
</div>
|
<div>{$_('toolbar.routing.help_multiple_files')}</div>
|
||||||
<Alert.Root class="max-w-64">
|
{:else if $selectedFiles.size == 0}
|
||||||
<CircleHelp size="16" />
|
<div>{$_('toolbar.routing.help_no_file')}</div>
|
||||||
<!-- <Alert.Title>Heads up!</Alert.Title> -->
|
{:else}
|
||||||
<Alert.Description>
|
<div>{$_('toolbar.routing.help')}</div>
|
||||||
{#if $selectedFiles.size > 1}
|
{/if}
|
||||||
<div>{$_('toolbar.routing.help_multiple_files')}</div>
|
</Alert.Description>
|
||||||
{:else if $selectedFiles.size == 0}
|
</Alert.Root>
|
||||||
<div>{$_('toolbar.routing.help_no_file')}</div>
|
</ToolbarItemMenu>
|
||||||
{:else}
|
|
||||||
<div>{$_('toolbar.routing.help')}</div>
|
|
||||||
{/if}
|
|
||||||
</Alert.Description>
|
|
||||||
</Alert.Root>
|
|
||||||
</Card.Content>
|
|
||||||
</Card.Root>
|
|
||||||
</ToolbarItemMenu>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<RoutingControlPopup bind:element={popupElement} />
|
<RoutingControlPopup bind:element={popupElement} />
|
||||||
|
@@ -0,0 +1,24 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import ToolbarItemMenu from '$lib/components/toolbar/ToolbarItemMenu.svelte';
|
||||||
|
import * as Alert from '$lib/components/ui/alert';
|
||||||
|
import { CircleHelp } from 'lucide-svelte';
|
||||||
|
|
||||||
|
import { Tool, selectedFiles } from '$lib/stores';
|
||||||
|
|
||||||
|
import { _ } from 'svelte-i18n';
|
||||||
|
|
||||||
|
$: $selectedFiles.forEach((file) => {
|
||||||
|
// todo
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<ToolbarItemMenu tool={Tool.WAYPOINT}>
|
||||||
|
<div class="w-full flex flex-row justify-between items-center gap-2">todo</div>
|
||||||
|
|
||||||
|
<Alert.Root class="max-w-64">
|
||||||
|
<CircleHelp size="16" />
|
||||||
|
<Alert.Description>
|
||||||
|
<div>{$_('toolbar.waypoint.help')}</div>
|
||||||
|
</Alert.Description>
|
||||||
|
</Alert.Root>
|
||||||
|
</ToolbarItemMenu>
|
@@ -4,6 +4,7 @@ import mapboxgl from 'mapbox-gl';
|
|||||||
import { GPXFile, buildGPX, parseGPX, type AnyGPXTreeElement } from 'gpx';
|
import { GPXFile, buildGPX, parseGPX, type AnyGPXTreeElement } from 'gpx';
|
||||||
import { tick } from 'svelte';
|
import { tick } from 'svelte';
|
||||||
import { _ } from 'svelte-i18n';
|
import { _ } from 'svelte-i18n';
|
||||||
|
import type { GPXLayer } from '$lib/components/gpx-layer/GPXLayer';
|
||||||
|
|
||||||
export const map = writable<mapboxgl.Map | null>(null);
|
export const map = writable<mapboxgl.Map | null>(null);
|
||||||
export const files = writable<Writable<GPXFile>[]>([]);
|
export const files = writable<Writable<GPXFile>[]>([]);
|
||||||
@@ -16,8 +17,19 @@ export const settings = writable<{ [key: string]: any }>({
|
|||||||
temperatureUnits: 'celsius',
|
temperatureUnits: 'celsius',
|
||||||
mode: 'system'
|
mode: 'system'
|
||||||
});
|
});
|
||||||
|
export const gpxLayers: Writable<Map<Writable<GPXFile>, GPXLayer>> = writable(new Map());
|
||||||
|
|
||||||
export enum Tool {
|
export enum Tool {
|
||||||
ROUTING
|
ROUTING,
|
||||||
|
TIME,
|
||||||
|
REVERSE,
|
||||||
|
MERGE,
|
||||||
|
EXTRACT,
|
||||||
|
WAYPOINT,
|
||||||
|
REDUCE,
|
||||||
|
CLEAN,
|
||||||
|
STYLE,
|
||||||
|
STRUCTURE
|
||||||
}
|
}
|
||||||
export const currentTool = writable<Tool | null>(null);
|
export const currentTool = writable<Tool | null>(null);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user