arreglar espaciado al trasponer acordes

This commit is contained in:
Carlos Galindo 2022-11-22 18:58:31 +01:00
parent 36db883be7
commit e6b10585b7

View file

@ -33,12 +33,16 @@ function transpose(n) {
function transposeAdd(n) { function transposeAdd(n) {
for (c of document.getElementsByClassName('c')) { for (c of document.getElementsByClassName('c')) {
chord = c.innerHTML chord = c.innerHTML
nbsp = chord.endsWith(" ")
if (nbsp) {
chord = chord.slice(0, -6)
}
if (LAT_INDEX[chord] == undefined) { if (LAT_INDEX[chord] == undefined) {
throw Error("Unknown chord: " + chord) throw Error("Unknown chord: " + chord)
} }
i = LAT_INDEX[chord] i = LAT_INDEX[chord]
j = (i + n + 12) % 12 j = (i + n + 12) % 12
c.innerHTML = CHORDS_LAT[j] c.innerHTML = CHORDS_LAT[j] + (nbsp ? " " : "")
} }
setTransposeSelector(getTranspose() + n) setTransposeSelector(getTranspose() + n)