diff --git a/libs/annotation/src/lib/annotation.ts b/libs/annotation/src/lib/annotation.ts index 649f81b47..971ea690a 100644 --- a/libs/annotation/src/lib/annotation.ts +++ b/libs/annotation/src/lib/annotation.ts @@ -328,7 +328,7 @@ export class OctraAnnotation< new OctraAnnotationSegment( this.idCounters.item++, time!, - labels ?? oldLabels, + labels && (labels.length > 0) ? labels : oldLabels, context ?? {} ) as any, ]; @@ -880,7 +880,9 @@ export class OctraAnnotationEventLevel { getRightSibling(item: OctraAnnotationEvent) { const index = this.items.findIndex((a) => a.id === item.id); - return index > -1 && index < this.items.length - 1 ? this.items[index + 1] : undefined; + return index > -1 && index < this.items.length - 1 + ? this.items[index + 1] + : undefined; } } diff --git a/libs/ngx-components/src/lib/components/audio/audio-viewer/audio-viewer.service.ts b/libs/ngx-components/src/lib/components/audio/audio-viewer/audio-viewer.service.ts index 21fda15b0..630533fb2 100644 --- a/libs/ngx-components/src/lib/components/audio/audio-viewer/audio-viewer.service.ts +++ b/libs/ngx-components/src/lib/components/audio/audio-viewer/audio-viewer.service.ts @@ -893,8 +893,7 @@ export class AudioViewerService { // no selection this.addSegment( - this.audioManager!.createSampleUnit(Math.round(absXTime)), - '' + this.audioManager!.createSampleUnit(Math.round(absXTime)) ); return { @@ -1199,16 +1198,18 @@ export class AudioViewerService { } public addSegment(start: SampleUnit, value?: string) { - const result = this.annotation!.addItemToCurrentLevel(start, [ - new OLabel(this.currentLevel!.name, value ?? ''), - ]); + const result = this.annotation!.addItemToCurrentLevel( + start, + value ? [new OLabel(this.currentLevel!.name, value)] : undefined + ); this.currentLevelChange.emit({ type: 'add', items: [ { - instance: this.annotation!.createSegment(start, [ - new OLabel(this.currentLevel!.name, value ?? ''), - ]), + instance: this.annotation!.createSegment( + start, + value ? [new OLabel(this.currentLevel!.name, value)] : undefined + ), }, ], });