Skip to content

Commit e2016ed

Browse files
committed
fix last issue
1 parent 91adabb commit e2016ed

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

front/src/applications/editor/tools/trackEdition/components.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ export const TrackEditionLeftPanel: FC = () => {
442442
}
443443
setState({
444444
...state,
445-
track: { ...(checkedTrack as TrackSectionEntity) },
445+
track: checkedTrack as TrackSectionEntity,
446446
});
447447
}}
448448
>

front/src/applications/editor/tools/trackEdition/utils.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@ export function injectGeometry(track: EditorEntity): EditorEntity {
3333

3434
/**
3535
* Remove the invalid ranges when the length of the track section has been modified
36+
* - keep ranges if begin is undefined in case we just added a new one or if we deleted the begin input value
3637
* - remove ranges which start after the new end
3738
* - cut the ranges which start before the new end but end after it
3839
*/
3940
export function removeInvalidRanges<T>(values: LinearMetadataItem<T>[], newLength: number) {
4041
return values
41-
.filter((item) => item.begin < newLength)
42+
.filter((item) => item.begin < newLength || !item.begin)
4243
.map((item) => (item.end >= newLength ? { ...item, end: newLength } : item));
4344
}

0 commit comments

Comments
 (0)