mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-08-31 15:43:25 +00:00
polish toolbar and routing menu
This commit is contained in:
@@ -23,9 +23,9 @@
|
||||
Thermometer,
|
||||
Sun,
|
||||
Moon,
|
||||
Rows3,
|
||||
Layers3,
|
||||
MountainSnow
|
||||
MountainSnow,
|
||||
GalleryVertical
|
||||
} from 'lucide-svelte';
|
||||
|
||||
import {
|
||||
@@ -181,7 +181,7 @@
|
||||
<MountainSnow size="16" class="mr-1" />{$_('menu.elevation_profile')}
|
||||
</Menubar.CheckboxItem>
|
||||
<Menubar.CheckboxItem bind:checked={$verticalFileView}>
|
||||
<Rows3 size="16" class="mr-1" />{$_('menu.vertical_file_view')}
|
||||
<GalleryVertical size="16" class="mr-1" />{$_('menu.vertical_file_view')}
|
||||
</Menubar.CheckboxItem>
|
||||
<Menubar.Separator />
|
||||
<Menubar.Item inset on:click={switchBasemaps}
|
||||
|
@@ -20,10 +20,10 @@
|
||||
<div class="absolute top-0 bottom-0 left-0 z-20 flex flex-col justify-center pointer-events-none">
|
||||
<div class="flex flex-row w-screen items-center">
|
||||
<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.5 bg-background rounded-md pointer-events-auto shadow-md"
|
||||
>
|
||||
<ToolbarItem tool={Tool.ROUTING}>
|
||||
<Pencil slot="icon" size="18" />
|
||||
<Pencil slot="icon" size="18" class="h-" />
|
||||
<span slot="tooltip">{$_('toolbar.routing.tooltip')}</span>
|
||||
</ToolbarItem>
|
||||
<ToolbarItem tool={Tool.SCISSORS}>
|
||||
|
@@ -15,7 +15,7 @@
|
||||
<Button
|
||||
builders={[builder]}
|
||||
variant="ghost"
|
||||
class="h-fit px-1 py-1.5 {$currentTool === tool ? 'bg-accent' : ''}"
|
||||
class="h-[26px] px-1 py-1.5 {$currentTool === tool ? 'bg-accent' : ''}"
|
||||
on:click={toggleTool}
|
||||
>
|
||||
<slot name="icon" />
|
||||
|
@@ -29,8 +29,8 @@
|
||||
class="translate-x-1 h-full {$$props.class ?? ''}"
|
||||
>
|
||||
<div class="rounded-md shadow-md pointer-events-auto">
|
||||
<Card.Root class="border-none">
|
||||
<Card.Content class="p-3">
|
||||
<Card.Root class="rounded-md border-none">
|
||||
<Card.Content class="p-2.5">
|
||||
{#if $currentTool === Tool.ROUTING}
|
||||
<Routing {popup} {popupElement} />
|
||||
{:else if $currentTool === Tool.SCISSORS}
|
||||
|
@@ -14,7 +14,10 @@
|
||||
TriangleAlert,
|
||||
ArrowRightLeft,
|
||||
Home,
|
||||
RouteOff
|
||||
RouteOff,
|
||||
Repeat,
|
||||
Maximize2,
|
||||
Minimize2
|
||||
} from 'lucide-svelte';
|
||||
|
||||
import { map, routingControls } from '$lib/stores';
|
||||
@@ -29,12 +32,13 @@
|
||||
import { slide } from 'svelte/transition';
|
||||
import { selection } from '$lib/components/file-list/Selection';
|
||||
import { ListRootItem, type ListItem } from '$lib/components/file-list/FileList';
|
||||
import { flyAndScale } from '$lib/utils';
|
||||
|
||||
export let popup: mapboxgl.Popup;
|
||||
export let popupElement: HTMLElement;
|
||||
let selectedItem: ListItem | null = null;
|
||||
|
||||
const { privateRoads, routing } = settings;
|
||||
const { minimizeRoutingMenu, privateRoads, routing } = settings;
|
||||
|
||||
$: if ($map) {
|
||||
// remove controls for deleted files
|
||||
@@ -62,106 +66,124 @@
|
||||
$: validSelection = $selection.hasAnyChildren(new ListRootItem(), true, ['waypoints']);
|
||||
</script>
|
||||
|
||||
<div class=" flex flex-col gap-3">
|
||||
<Tooltip>
|
||||
<div slot="data" class="w-full flex flex-row justify-between items-center gap-2">
|
||||
<Label for="routing" class="flex flex-row gap-1">
|
||||
{#if $routing}
|
||||
<Route size="16" />
|
||||
{:else}
|
||||
<RouteOff size="16" />
|
||||
{/if}
|
||||
{$_('toolbar.routing.use_routing')}</Label
|
||||
>
|
||||
<Switch id="routing" class="scale-90" bind:checked={$routing} />
|
||||
</div>
|
||||
<span slot="tooltip">{$_('toolbar.routing.use_routing_tooltip')}</span>
|
||||
</Tooltip>
|
||||
|
||||
{#if $routing}
|
||||
<div class="flex flex-col gap-3" in:slide>
|
||||
<div class="w-full flex flex-row justify-between items-center gap-2">
|
||||
<Label class="flex flex-row gap-1">
|
||||
{#if $routingProfileSelectItem.value.includes('bike') || $routingProfileSelectItem.value.includes('motorcycle')}
|
||||
<Bike size="16" />
|
||||
{:else if $routingProfileSelectItem.value.includes('foot')}
|
||||
<Footprints size="16" />
|
||||
{:else if $routingProfileSelectItem.value.includes('water')}
|
||||
<Waves size="16" />
|
||||
{:else if $routingProfileSelectItem.value.includes('railway')}
|
||||
<TrainFront size="16" />
|
||||
{/if}
|
||||
{$_('toolbar.routing.activity')}
|
||||
</Label>
|
||||
<Select.Root bind:selected={$routingProfileSelectItem}>
|
||||
<Select.Trigger class="h-8 w-full">
|
||||
<Select.Value />
|
||||
</Select.Trigger>
|
||||
<Select.Content>
|
||||
{#each Object.keys(brouterProfiles) as profile}
|
||||
<Select.Item value={profile}
|
||||
>{$_(`toolbar.routing.activities.${profile}`)}</Select.Item
|
||||
>
|
||||
{/each}
|
||||
</Select.Content>
|
||||
</Select.Root>
|
||||
</div>
|
||||
<div class="w-full flex flex-row justify-between items-center gap-2">
|
||||
<Label for="private" class="flex flex-row gap-1"
|
||||
><TriangleAlert size="16" />{$_('toolbar.routing.allow_private')}</Label
|
||||
>
|
||||
<Switch id="private" class="scale-90" bind:checked={$privateRoads} />
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="flex flex-row justify-center gap-2">
|
||||
<Tooltip>
|
||||
<Button
|
||||
slot="data"
|
||||
variant="outline"
|
||||
disabled={!validSelection}
|
||||
on:click={dbUtils.reverseSelection}
|
||||
>
|
||||
<ArrowRightLeft size="16" />
|
||||
</Button>
|
||||
<span slot="tooltip">{$_('toolbar.routing.reverse_tooltip')}</span>
|
||||
</Tooltip>
|
||||
<Tooltip>
|
||||
<Button
|
||||
slot="data"
|
||||
variant="outline"
|
||||
disabled={$selection.size != 1 || !validSelection}
|
||||
on:click={() => {
|
||||
const fileId = get(selection).getSelected()[0].getFileId();
|
||||
routingControls.get(fileId)?.routeToStart();
|
||||
}}
|
||||
>
|
||||
<Home size="16" />
|
||||
</Button>
|
||||
<span slot="tooltip">{$_('toolbar.routing.route_back_to_start_tooltip')}</span>
|
||||
</Tooltip>
|
||||
<Tooltip>
|
||||
<Button
|
||||
slot="data"
|
||||
variant="outline"
|
||||
disabled={$selection.size != 1 || !validSelection}
|
||||
on:click={() => {
|
||||
const fileId = get(selection).getSelected()[0].getFileId();
|
||||
routingControls.get(fileId)?.createRoundTrip();
|
||||
}}
|
||||
>
|
||||
<Home size="16" />
|
||||
</Button>
|
||||
<span slot="tooltip">{$_('toolbar.routing.round_trip_tooltip')}</span>
|
||||
</Tooltip>
|
||||
{#if $minimizeRoutingMenu}
|
||||
<div class="-m-1.5 -mb-2">
|
||||
<Button variant="ghost" class="px-1 h-[26px]" on:click={() => ($minimizeRoutingMenu = false)}>
|
||||
<Maximize2 size="18" />
|
||||
</Button>
|
||||
</div>
|
||||
<Help class="max-w-60">
|
||||
{#if $selection.size > 1}
|
||||
<div>{$_('toolbar.routing.help_multiple_files')}</div>
|
||||
{:else if $selection.size == 0 || !validSelection}
|
||||
<div>{$_('toolbar.routing.help_no_file')}</div>
|
||||
{:else}
|
||||
<div>{$_('toolbar.routing.help')}</div>
|
||||
{/if}
|
||||
</Help>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="flex flex-col gap-3 max-w-80" in:flyAndScale={{ x: -2, y: 0, duration: 50 }}>
|
||||
<div class="w-full flex flex-row gap-2 justify-between">
|
||||
<div class="grow flex flex-col gap-3">
|
||||
<Tooltip>
|
||||
<Label slot="data" class="w-full flex flex-row justify-between items-center gap-2">
|
||||
<span class="flex flex-row gap-1">
|
||||
{#if $routing}
|
||||
<Route size="16" />
|
||||
{:else}
|
||||
<RouteOff size="16" />
|
||||
{/if}
|
||||
{$_('toolbar.routing.use_routing')}
|
||||
</span>
|
||||
|
||||
<Switch class="scale-90" bind:checked={$routing} />
|
||||
</Label>
|
||||
<span slot="tooltip">{$_('toolbar.routing.use_routing_tooltip')}</span>
|
||||
</Tooltip>
|
||||
{#if $routing}
|
||||
<div class="flex flex-col gap-3" in:slide>
|
||||
<Label class="w-full flex flex-row justify-between items-center gap-2">
|
||||
<span class="shrink-0 flex flex-row items-center gap-1">
|
||||
{#if $routingProfileSelectItem.value.includes('bike') || $routingProfileSelectItem.value.includes('motorcycle')}
|
||||
<Bike size="16" />
|
||||
{:else if $routingProfileSelectItem.value.includes('foot')}
|
||||
<Footprints size="16" />
|
||||
{:else if $routingProfileSelectItem.value.includes('water')}
|
||||
<Waves size="16" />
|
||||
{:else if $routingProfileSelectItem.value.includes('railway')}
|
||||
<TrainFront size="16" />
|
||||
{/if}
|
||||
{$_('toolbar.routing.activity')}
|
||||
</span>
|
||||
<Select.Root bind:selected={$routingProfileSelectItem}>
|
||||
<Select.Trigger class="h-8 grow">
|
||||
<Select.Value />
|
||||
</Select.Trigger>
|
||||
<Select.Content>
|
||||
{#each Object.keys(brouterProfiles) as profile}
|
||||
<Select.Item value={profile}
|
||||
>{$_(`toolbar.routing.activities.${profile}`)}</Select.Item
|
||||
>
|
||||
{/each}
|
||||
</Select.Content>
|
||||
</Select.Root>
|
||||
</Label>
|
||||
<Label class="w-full flex flex-row justify-between items-center gap-2">
|
||||
<span class="flex flex-row gap-1"
|
||||
><TriangleAlert size="16" />{$_('toolbar.routing.allow_private')}</span
|
||||
>
|
||||
<Switch class="scale-90" bind:checked={$privateRoads} />
|
||||
</Label>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<Button variant="ghost" class="px-1 h-6" on:click={() => ($minimizeRoutingMenu = true)}>
|
||||
<Minimize2 size="14" />
|
||||
</Button>
|
||||
</div>
|
||||
<div class="flex flex-row flex-wrap justify-center gap-1">
|
||||
<Tooltip>
|
||||
<Button
|
||||
slot="data"
|
||||
variant="outline"
|
||||
class="flex flex-row gap-1 text-xs px-2"
|
||||
disabled={!validSelection}
|
||||
on:click={dbUtils.reverseSelection}
|
||||
>
|
||||
<ArrowRightLeft size="12" />{$_('toolbar.routing.reverse.button')}
|
||||
</Button>
|
||||
<span slot="tooltip">{$_('toolbar.routing.reverse.tooltip')}</span>
|
||||
</Tooltip>
|
||||
<Tooltip>
|
||||
<Button
|
||||
slot="data"
|
||||
variant="outline"
|
||||
class="flex flex-row gap-1 text-xs px-2"
|
||||
disabled={$selection.size != 1 || !validSelection}
|
||||
on:click={() => {
|
||||
const fileId = get(selection).getSelected()[0].getFileId();
|
||||
routingControls.get(fileId)?.routeToStart();
|
||||
}}
|
||||
>
|
||||
<Home size="12" />{$_('toolbar.routing.route_back_to_start.button')}
|
||||
</Button>
|
||||
<span slot="tooltip">{$_('toolbar.routing.route_back_to_start.tooltip')}</span>
|
||||
</Tooltip>
|
||||
<Tooltip>
|
||||
<Button
|
||||
slot="data"
|
||||
variant="outline"
|
||||
class="flex flex-row gap-1 text-xs px-2"
|
||||
disabled={$selection.size != 1 || !validSelection}
|
||||
on:click={() => {
|
||||
const fileId = get(selection).getSelected()[0].getFileId();
|
||||
routingControls.get(fileId)?.createRoundTrip();
|
||||
}}
|
||||
>
|
||||
<Repeat size="12" />{$_('toolbar.routing.round_trip.button')}
|
||||
</Button>
|
||||
<span slot="tooltip">{$_('toolbar.routing.round_trip.tooltip')}</span>
|
||||
</Tooltip>
|
||||
</div>
|
||||
<Help>
|
||||
{#if $selection.size > 1}
|
||||
<div>{$_('toolbar.routing.help_multiple_files')}</div>
|
||||
{:else if $selection.size == 0 || !validSelection}
|
||||
<div>{$_('toolbar.routing.help_no_file')}</div>
|
||||
{:else}
|
||||
<div>{$_('toolbar.routing.help')}</div>
|
||||
{/if}
|
||||
</Help>
|
||||
</div>
|
||||
{/if}
|
||||
|
@@ -87,6 +87,7 @@ export const settings = {
|
||||
}
|
||||
return currentMode;
|
||||
})()),
|
||||
minimizeRoutingMenu: dexieSettingStore('minimizeRoutingMenu', false),
|
||||
routing: dexieSettingStore('routing', true),
|
||||
routingProfile: dexieSettingStore('routingProfile', 'bike'),
|
||||
privateRoads: dexieSettingStore('privateRoads', false),
|
||||
|
@@ -3,7 +3,7 @@
|
||||
"file": "File",
|
||||
"create": "Create",
|
||||
"new_filename": "new",
|
||||
"load_desktop": "Load from desktop...",
|
||||
"load_desktop": "Load...",
|
||||
"load_drive": "Load from Google Drive...",
|
||||
"duplicate": "Duplicate",
|
||||
"export": "Export...",
|
||||
@@ -47,14 +47,23 @@
|
||||
"tooltip": "Edit the route",
|
||||
"activity": "Activity",
|
||||
"use_routing": "Routing",
|
||||
"use_routing_tooltip": "Connect anchor points through the road network. Disable to draw straight lines.",
|
||||
"use_routing_tooltip": "Connect anchor points via road network or with straight lines when disabled",
|
||||
"allow_private": "Allow private roads",
|
||||
"reverse_tooltip": "Reverse the direction",
|
||||
"route_back_to_start_tooltip": "Route back to start",
|
||||
"round_trip_tooltip": "Create round trip",
|
||||
"reverse": {
|
||||
"button": "Reverse",
|
||||
"tooltip": "Reverse the direction of the route"
|
||||
},
|
||||
"route_back_to_start": {
|
||||
"button": "Back to start",
|
||||
"tooltip": "Connect the last point of the route with the starting point"
|
||||
},
|
||||
"round_trip": {
|
||||
"button": "Round trip",
|
||||
"tooltip": "Return to the starting point by the same route"
|
||||
},
|
||||
"help_no_file": "Select a file element to use the routing tool, or create a new file from the menu",
|
||||
"help_multiple_files": "Select a single file element to use the routing tool",
|
||||
"help": "Click on the map to add a new point, or drag existing points to change the route",
|
||||
"help": "Click on the map to add a new anchor point, or drag existing ones to change the route",
|
||||
"activities": {
|
||||
"bike": "Bike",
|
||||
"racing_bike": "Racing bike",
|
||||
|
Reference in New Issue
Block a user