mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2026-11-15 07:07:07 +00:00
show hovered point on elevation profile
This commit is contained in:
1 parent
b80fa7d942
commit
21e27a4416
15 files changed
+260
-106
No files matched your search
@@ -259,7 +259,7 @@ describe('statistics', () => {
|
||||
assert.equal(get(engine.statistics).hr, undefined);
|
||||
|
||||
const request = engine.requestStatistics();
|
||||
await request.set(['hr', 'anchors', 'slopeSegment']);
|
||||
await request.set(['hr', 'anchors', 'slopeSegment', 'segments']);
|
||||
const statistics = get(engine.statistics);
|
||||
assert.equal(statistics.slopeSegments!.starts[0], 0);
|
||||
assert.equal(
|
||||
@@ -270,6 +270,8 @@ describe('statistics', () => {
|
||||
assert.ok(statistics.hr!.some((hr) => !Number.isNaN(hr)));
|
||||
assert.equal(statistics.cad, undefined);
|
||||
assert.equal(statistics.anchors!.indices[0], 0);
|
||||
assert.deepEqual([...statistics.segments!.starts], [...statistics.anchors!.segmentStarts]);
|
||||
assert.deepEqual(statistics.segments!.ids, statistics.anchors!.segmentIds);
|
||||
assert.equal(statistics.anchors!.indices.at(-1), statistics.length - 1);
|
||||
|
||||
// they are read again after a change, without being asked again
|
||||
|
||||
@@ -143,6 +143,14 @@ export class StatisticsReader {
|
||||
};
|
||||
break;
|
||||
}
|
||||
case 'segments': {
|
||||
const [starts, ids] = await Promise.all([
|
||||
backend.segment_starts(),
|
||||
backend.segment_ids(),
|
||||
]);
|
||||
statistics.segments = { starts, ids };
|
||||
break;
|
||||
}
|
||||
case 'highway':
|
||||
[statistics.highway, statistics.sacScale, statistics.mtbScale] =
|
||||
await Promise.all([
|
||||
|
||||
@@ -155,7 +155,9 @@ export type StatisticsMetric =
|
||||
/** `highway`, `sacScale` and `mtbScale`. */
|
||||
| 'highway'
|
||||
/** `anchors`. */
|
||||
| 'anchors';
|
||||
| 'anchors'
|
||||
/** `segments`. */
|
||||
| 'segments';
|
||||
|
||||
/**
|
||||
* The anchors of the routing tool among the trackpoints of the selection: the points that can be
|
||||
@@ -182,6 +184,15 @@ export type SelectionAnchors = {
|
||||
revision: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* The segments of the selection that have trackpoints: segment `i` has the id `ids[i]`, and its
|
||||
* trackpoints go from `starts[i]` until the next start (or the last trackpoint).
|
||||
*/
|
||||
export type SelectionSegments = {
|
||||
starts: Uint32Array;
|
||||
ids: string[];
|
||||
};
|
||||
|
||||
/**
|
||||
* The smoothed elevation segments of the selection, over which the slope is averaged, as the
|
||||
* intervals of trackpoints that belong to the same one: segment `i` starts at the trackpoint
|
||||
@@ -229,6 +240,7 @@ export type SelectionStatistics = {
|
||||
/** Mountain biking scale. */
|
||||
mtbScale?: CategoryIntervals;
|
||||
anchors?: SelectionAnchors;
|
||||
segments?: SelectionSegments;
|
||||
|
||||
/**
|
||||
* Global statistics of the trackpoints from `start` to `end` (both included), for example
|
||||
|
||||
Reference in new issue
Block a user