bugfix transposing

This commit is contained in:
2021-05-23 13:53:33 +02:00
parent 6c15976f14
commit 3b4dfb5c0e
7 changed files with 56 additions and 35 deletions

View File

@@ -42,15 +42,14 @@ export class TextRenderingService {
}
private getLineOfLineText(text: string, transpose: TransposeMode | null): Line | null {
if (!text) {
return null;
}
if (!text) return null;
const cords = this.readChords(text);
const hasMatches = cords.length > 0;
const type = hasMatches ? LineType.chord : LineType.text;
const line: Line = {type, text, chords: hasMatches ? cords : null};
return transpose
return transpose !== null && transpose !== undefined
? this.transposeService.transpose(line, transpose.baseKey, transpose.targetKey)
: this.transposeService.renderChords(line);
}