mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2026-11-30 09:34:29 +00:00
* wasm first steps * parsing start * parsing continued * progress * progress * progress * progress * progress * progress * progress * progress * fixes * reorganize * change type * fix * progress * refactoring * progress * progress * progress * keep style info * progress * progress * remove (copy) in name * progress * merge methods into 1 * splice * progress * progress * progress * cleaning * progress * progress * progress * visibility * progress * progress * progress * progress * progress * fixes * progress * fix markers * fix * progress * progress * progress * progress * progress * progress * small fix * use engine info * fix popups * small fix * progress * progress * progress * clean tool * handle self closing elements * reduce data exchanges across boundary * copy on wasm side to avoid any data corruption * speed fix * routing * refactoring * reverse * reverse * crop * split * merge * progress * time tool * fix bounds for waypoints * reduce * fix reactivity * handle corrupt time data * export * progress * remove gpx js package * remove todo * update readme * cleaning * progress * fix link fields * remove unused fields * refactoring and tests * import and export of routes, ref #192 * per-chunk categories storage * cross-tab sync * outdated state * refactoring * reorder methods * refactoring * fix * improve flow * renaming * progress * progress * fix * progress * per file history * keep original flag * use history variant * fix * progress * file explorer * progress * fix * sticky folders * improved sticky folders * fix sortable * fix sortable * fix * fix tab size * no file delete on desktop * fix routing on other file * fix sorting * remember language * open links in browser * commit missing changes * avoid selecting on resize * clarify filename * explorer actions * fix folder styling * drop anywhere in folder * cleaning * fixes * remove focus-ring * full screen * small fix * consistent highlight color * improved preview * performance improvements * sparser data transfers * sparser data transfers * show popup once data is loaded * fix routing control size * fix * sparse desktop build * remove custom ign styles * use new endpoint for openhikingmap * strip native menu * reorder context menu items * route full support * route - track conversion * create route file action * route export, filter out anchors at high zoom level * clarify name handling * move hide & center to view * routes continued * update docs * fix power format, closes #378 * lint fixes * fix display of additional data with gaps, closes #361 * fix linting issues * fix import modules * fix multidrag * change base to resolve * fix type errors * fix layer typings * fix last type error * each keys * improve typings * deploy to cloudflare --------- Co-authored-by: vcoppe <vcoppe@hexaly.com>
191 lines
8.4 KiB
Svelte
191 lines
8.4 KiB
Svelte
<script lang="ts">
|
|
import ButtonWithTooltip from '$lib/components/ButtonWithTooltip.svelte';
|
|
import * as Popover from '$lib/components/ui/popover/index.js';
|
|
import * as ToggleGroup from '$lib/components/ui/toggle-group/index.js';
|
|
import Separator from '$lib/components/ui/separator/separator.svelte';
|
|
import { onDestroy, onMount } from 'svelte';
|
|
import {
|
|
BrickWall,
|
|
TriangleRight,
|
|
HeartPulse,
|
|
Orbit,
|
|
SquareActivity,
|
|
Thermometer,
|
|
Zap,
|
|
Circle,
|
|
Check,
|
|
ChartNoAxesColumn,
|
|
Construction,
|
|
} from '@lucide/svelte';
|
|
import type { Readable, Writable } from 'svelte/store';
|
|
import type { Coordinates } from '$lib/geo/coordinates';
|
|
import type { SelectionStatistics } from '$lib/engine';
|
|
import type { SlicedStatistics } from '$lib/state/selection-statistics';
|
|
import { settings } from '$lib/state/settings';
|
|
import { i18n } from '$lib/i18n/i18n.svelte';
|
|
import { ElevationProfile } from '$lib/components/elevation-profile/elevation-profile';
|
|
|
|
const { velocityUnits } = settings;
|
|
|
|
let {
|
|
statistics,
|
|
slicedStatistics,
|
|
hoveredPoint,
|
|
additionalDatasets,
|
|
elevationFill,
|
|
showControls = true,
|
|
}: {
|
|
statistics: Readable<SelectionStatistics>;
|
|
slicedStatistics: Writable<SlicedStatistics | undefined>;
|
|
hoveredPoint: Writable<Coordinates | null>;
|
|
additionalDatasets: Writable<string[]>;
|
|
elevationFill: Writable<'slope' | 'surface' | 'highway' | undefined>;
|
|
showControls?: boolean;
|
|
} = $props();
|
|
|
|
let canvas: HTMLCanvasElement;
|
|
let overlay: HTMLCanvasElement;
|
|
let elevationProfile: ElevationProfile | null = null;
|
|
|
|
onMount(() => {
|
|
elevationProfile = new ElevationProfile(
|
|
statistics,
|
|
slicedStatistics,
|
|
hoveredPoint,
|
|
additionalDatasets,
|
|
elevationFill,
|
|
canvas,
|
|
overlay
|
|
);
|
|
});
|
|
|
|
onDestroy(() => {
|
|
if (elevationProfile) {
|
|
elevationProfile.destroy();
|
|
}
|
|
});
|
|
</script>
|
|
|
|
<div class="h-full grow min-w-0 min-h-0 relative">
|
|
<canvas bind:this={overlay} class="w-full h-full absolute pointer-events-none"></canvas>
|
|
<canvas bind:this={canvas} class="w-full h-full absolute"></canvas>
|
|
{#if showControls}
|
|
<div class="absolute bottom-9 right-2.5">
|
|
<Popover.Root>
|
|
<Popover.Trigger>
|
|
<ButtonWithTooltip
|
|
label={i18n._('chart.settings')}
|
|
variant="outline"
|
|
side="left"
|
|
class="w-7 h-7 p-0 flex justify-center opacity-70 hover:opacity-100 transition-opacity duration-300 bg-background"
|
|
>
|
|
<ChartNoAxesColumn size="18" />
|
|
</ButtonWithTooltip>
|
|
</Popover.Trigger>
|
|
<Popover.Content
|
|
class="w-fit p-0 flex flex-col gap-0 overflow-hidden"
|
|
side="top"
|
|
align="end"
|
|
sideOffset={-32}
|
|
>
|
|
<ToggleGroup.Root
|
|
class="flex flex-col w-full border-none"
|
|
type="single"
|
|
size="sm"
|
|
bind:value={$elevationFill}
|
|
>
|
|
<ToggleGroup.Item value="slope" class="w-full flex flex-row justify-start">
|
|
<div class="w-6 flex justify-center items-center">
|
|
{#if $elevationFill === 'slope'}
|
|
<Circle class="size-1.5 fill-current text-current" />
|
|
{/if}
|
|
</div>
|
|
<TriangleRight size="15" />
|
|
{i18n._('quantities.slope')}
|
|
</ToggleGroup.Item>
|
|
<ToggleGroup.Item
|
|
value="surface"
|
|
class="w-full flex flex-row justify-start"
|
|
>
|
|
<div class="w-6 flex justify-center items-center">
|
|
{#if $elevationFill === 'surface'}
|
|
<Circle class="size-1.5 fill-current text-current" />
|
|
{/if}
|
|
</div>
|
|
<BrickWall size="15" />
|
|
{i18n._('quantities.surface')}
|
|
</ToggleGroup.Item>
|
|
<ToggleGroup.Item
|
|
value="highway"
|
|
class="w-full flex flex-row justify-start"
|
|
>
|
|
<div class="w-6 flex justify-center items-center">
|
|
{#if $elevationFill === 'highway'}
|
|
<Circle class="size-1.5 fill-current text-current" />
|
|
{/if}
|
|
</div>
|
|
<Construction size="15" />
|
|
{i18n._('quantities.highway')}
|
|
</ToggleGroup.Item>
|
|
</ToggleGroup.Root>
|
|
<Separator />
|
|
<ToggleGroup.Root
|
|
class="flex flex-col gap-0"
|
|
type="multiple"
|
|
size="sm"
|
|
bind:value={$additionalDatasets}
|
|
>
|
|
<ToggleGroup.Item value="speed" class="w-full flex flex-row justify-start">
|
|
<div class="w-6 flex justify-center items-center">
|
|
{#if $additionalDatasets.includes('speed')}
|
|
<Check size="14" />
|
|
{/if}
|
|
</div>
|
|
<Zap size="15" />
|
|
{$velocityUnits === 'speed'
|
|
? i18n._('quantities.speed')
|
|
: i18n._('quantities.pace')}
|
|
</ToggleGroup.Item>
|
|
<ToggleGroup.Item value="hr" class="w-full flex flex-row justify-start">
|
|
<div class="w-6 flex justify-center items-center">
|
|
{#if $additionalDatasets.includes('hr')}
|
|
<Check size="14" />
|
|
{/if}
|
|
</div>
|
|
<HeartPulse size="15" />
|
|
{i18n._('quantities.heartrate')}
|
|
</ToggleGroup.Item>
|
|
<ToggleGroup.Item value="cad" class="w-full flex flex-row justify-start">
|
|
<div class="w-6 flex justify-center items-center">
|
|
{#if $additionalDatasets.includes('cad')}
|
|
<Check size="14" />
|
|
{/if}
|
|
</div>
|
|
<Orbit size="15" />
|
|
{i18n._('quantities.cadence')}
|
|
</ToggleGroup.Item>
|
|
<ToggleGroup.Item value="atemp" class="w-full flex flex-row justify-start">
|
|
<div class="w-6 flex justify-center items-center">
|
|
{#if $additionalDatasets.includes('atemp')}
|
|
<Check size="14" />
|
|
{/if}
|
|
</div>
|
|
<Thermometer size="15" />
|
|
{i18n._('quantities.temperature')}
|
|
</ToggleGroup.Item>
|
|
<ToggleGroup.Item value="power" class="w-full flex flex-row justify-start">
|
|
<div class="w-6 flex justify-center items-center">
|
|
{#if $additionalDatasets.includes('power')}
|
|
<Check size="14" />
|
|
{/if}
|
|
</div>
|
|
<SquareActivity size="15" />
|
|
{i18n._('quantities.power')}
|
|
</ToggleGroup.Item>
|
|
</ToggleGroup.Root>
|
|
</Popover.Content>
|
|
</Popover.Root>
|
|
</div>
|
|
{/if}
|
|
</div>
|