Files
gpx.studio/website/src/lib/state/selection-statistics.ts
T

20 lines
861 B
TypeScript
Raw Normal View History

2026-10-08 18:34:19 +02:00
import { writable, type Writable } from 'svelte/store';
2026-10-04 11:52:46 +02:00
import { engine, type GlobalStatistics } from '$lib/engine';
2026-10-11 11:18:36 +02:00
import type { Coordinates } from '$lib/geo/coordinates';
2026-10-04 11:52:46 +02:00
/** The part of the selection that is highlighted in the elevation profile. */
export type SlicedStatistics = {
/** Statistics of the part. */
global: GlobalStatistics;
/** Indices of its first and last trackpoints in the statistics of the selection. */
start: number;
end: number;
};
export const slicedStatistics = writable<SlicedStatistics | undefined>(undefined);
// the indices only make sense for the selection they were made on
engine.statistics.subscribe(() => slicedStatistics.set(undefined));
2026-10-08 18:34:19 +02:00
/** The point of the elevation profile that the pointer is over, shown on the map. */
export const hoveredPoint: Writable<Coordinates | null> = writable(null);