Skip to content

Commit 5fc3cb7

Browse files
committed
fix(ngx-components): placing boundary on transcribed segment removes transcript
1 parent 3eeb18a commit 5fc3cb7

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

libs/annotation/src/lib/annotation.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ export class OctraAnnotation<
328328
new OctraAnnotationSegment(
329329
this.idCounters.item++,
330330
time!,
331-
labels ?? oldLabels,
331+
labels && (labels.length > 0) ? labels : oldLabels,
332332
context ?? {}
333333
) as any,
334334
];
@@ -880,7 +880,9 @@ export class OctraAnnotationEventLevel {
880880

881881
getRightSibling(item: OctraAnnotationEvent) {
882882
const index = this.items.findIndex((a) => a.id === item.id);
883-
return index > -1 && index < this.items.length - 1 ? this.items[index + 1] : undefined;
883+
return index > -1 && index < this.items.length - 1
884+
? this.items[index + 1]
885+
: undefined;
884886
}
885887
}
886888

libs/ngx-components/src/lib/components/audio/audio-viewer/audio-viewer.service.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -893,8 +893,7 @@ export class AudioViewerService {
893893
// no selection
894894

895895
this.addSegment(
896-
this.audioManager!.createSampleUnit(Math.round(absXTime)),
897-
''
896+
this.audioManager!.createSampleUnit(Math.round(absXTime))
898897
);
899898

900899
return {
@@ -1199,16 +1198,18 @@ export class AudioViewerService {
11991198
}
12001199

12011200
public addSegment(start: SampleUnit, value?: string) {
1202-
const result = this.annotation!.addItemToCurrentLevel(start, [
1203-
new OLabel(this.currentLevel!.name, value ?? ''),
1204-
]);
1201+
const result = this.annotation!.addItemToCurrentLevel(
1202+
start,
1203+
value ? [new OLabel(this.currentLevel!.name, value)] : undefined
1204+
);
12051205
this.currentLevelChange.emit({
12061206
type: 'add',
12071207
items: [
12081208
{
1209-
instance: this.annotation!.createSegment(start, [
1210-
new OLabel(this.currentLevel!.name, value ?? ''),
1211-
]),
1209+
instance: this.annotation!.createSegment(
1210+
start,
1211+
value ? [new OLabel(this.currentLevel!.name, value)] : undefined
1212+
),
12121213
},
12131214
],
12141215
});

0 commit comments

Comments
 (0)