Skip to content

Commit

Permalink
fix(ngx-components): placing boundary on transcribed segment removes …
Browse files Browse the repository at this point in the history
…transcript
  • Loading branch information
julianpoemp committed Jan 26, 2024
1 parent 3eeb18a commit 5fc3cb7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
6 changes: 4 additions & 2 deletions libs/annotation/src/lib/annotation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ export class OctraAnnotation<
new OctraAnnotationSegment(
this.idCounters.item++,
time!,
labels ?? oldLabels,
labels && (labels.length > 0) ? labels : oldLabels,
context ?? {}
) as any,
];
Expand Down Expand Up @@ -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;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -893,8 +893,7 @@ export class AudioViewerService {
// no selection

this.addSegment(
this.audioManager!.createSampleUnit(Math.round(absXTime)),
''
this.audioManager!.createSampleUnit(Math.round(absXTime))
);

return {
Expand Down Expand Up @@ -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
),
},
],
});
Expand Down

0 comments on commit 5fc3cb7

Please sign in to comment.