fix some typescript errors

This commit is contained in:
vcoppe
2025-11-10 13:11:44 +01:00
parent bce7b5984f
commit 16023b0688
13 changed files with 73 additions and 44 deletions

View File

@@ -324,7 +324,8 @@
if (
startDate === undefined ||
startTime === undefined ||
effectiveSpeed === undefined
effectiveSpeed === undefined ||
movingTime === undefined
) {
return;
}
@@ -347,12 +348,12 @@
if (item instanceof ListFileItem) {
if (artificial || !$gpxStatistics.global.time.moving) {
file.createArtificialTimestamps(
getDate(startDate, startTime),
movingTime
getDate(startDate!, startTime!),
movingTime!
);
} else {
file.changeTimestamps(
getDate(startDate, startTime),
getDate(startDate!, startTime!),
effectiveSpeed,
ratio
);
@@ -360,13 +361,13 @@
} else if (item instanceof ListTrackItem) {
if (artificial || !$gpxStatistics.global.time.moving) {
file.createArtificialTimestamps(
getDate(startDate, startTime),
movingTime,
getDate(startDate!, startTime!),
movingTime!,
item.getTrackIndex()
);
} else {
file.changeTimestamps(
getDate(startDate, startTime),
getDate(startDate!, startTime!),
effectiveSpeed,
ratio,
item.getTrackIndex()
@@ -375,14 +376,14 @@
} else if (item instanceof ListTrackSegmentItem) {
if (artificial || !$gpxStatistics.global.time.moving) {
file.createArtificialTimestamps(
getDate(startDate, startTime),
movingTime,
getDate(startDate!, startTime!),
movingTime!,
item.getTrackIndex(),
item.getSegmentIndex()
);
} else {
file.changeTimestamps(
getDate(startDate, startTime),
getDate(startDate!, startTime!),
effectiveSpeed,
ratio,
item.getTrackIndex(),

View File

@@ -494,7 +494,7 @@ export class RoutingControls {
segment.trkpt[before].time && segment.trkpt[before + 1].time
? new Date(
(1 - ratio) * segment.trkpt[before].time.getTime() +
ratio * segment.trkpt[before + 1].time.getTime()
ratio * segment.trkpt[before + 1].time!.getTime()
)
: undefined;
point._data = {
@@ -540,7 +540,7 @@ export class RoutingControls {
fileActionManager.applyToFile(this.fileId, (file) =>
file.replaceTrackPoints(anchor.trackIndex, anchor.segmentIndex, 0, 0, [])
);
} else if (previousAnchor === null) {
} else if (previousAnchor === null && nextAnchor !== null) {
// First point, remove trackpoints until nextAnchor
fileActionManager.applyToFile(this.fileId, (file) =>
file.replaceTrackPoints(
@@ -551,7 +551,7 @@ export class RoutingControls {
[]
)
);
} else if (nextAnchor === null) {
} else if (nextAnchor === null && previousAnchor !== null) {
// Last point, remove trackpoints from previousAnchor
fileActionManager.applyToFile(this.fileId, (file) => {
let segment = file.getSegment(anchor.trackIndex, anchor.segmentIndex);
@@ -563,7 +563,7 @@ export class RoutingControls {
[]
);
});
} else {
} else if (previousAnchor !== null && nextAnchor !== null) {
// Route between previousAnchor and nextAnchor
this.routeBetweenAnchors(
[previousAnchor, nextAnchor],