This commit is contained in:
vcoppe committed 2026-10-07 19:57:27 +02:00
1 parent 24b877c4ee
commit f642d60f42
6 files changed
+635 -183

No files matched your search

+17
View File
@@ -32,6 +32,12 @@ export type {
type Wasm = typeof import('gpx-rs');
/**
* How a merge puts the selected elements together: `connect` makes a single segment of their
* trackpoints, `group` keeps them as they are, in the first one.
*/
export type MergeType = 'connect' | 'group';
/** What a split cuts in two: the file, the track or the segment of the trackpoint. */
export type SplitType = 'files' | 'tracks' | 'segments';
@@ -648,6 +654,17 @@ class Engine {
return this.run((w) => w.reverse());
}
/**
* Merges the selected files, tracks or segments into the first of them (see `MergeType`). With
* `removeGaps`, the parts that are connected get closer in time if they have timestamps.
* Resolves to `false` when there is nothing to merge.
*/
merge(type: MergeType, removeGaps = false) {
return this.run((w) =>
w.merge(type === 'connect' ? w.MergeType.Connect : w.MergeType.Group, removeGaps)
);
}
/**
* Cuts the file, the track or the segment (see `SplitType`) of the trackpoint `at` of the
* selection in two, there: the trackpoint ends the first part and starts the second one. The