diff --git a/src/components/ChordChart.vue b/src/components/ChordChart.vue index b59d4cc..fcf14a6 100644 --- a/src/components/ChordChart.vue +++ b/src/components/ChordChart.vue @@ -49,11 +49,15 @@ import { computed, inject, ref, watch } from 'vue'; import { ChordProParser, Song } from 'chordsheetjs'; import ChordChartBodyParagraph from './ChordChartBodyParagraph.vue'; -defineProps({ +const props = defineProps({ columns: { type: Number, default: 1, }, + transposition: { + type: Number, + default: 0, + }, }); @@ -77,6 +81,13 @@ watch(chordProInput, (newValue) => { console.error(err); } }, { immediate: true }); + +watch(() => props.transposition, (newValue, oldValue) => { + if (song.value) { + const difference = newValue - oldValue; + song.value = song.value.transpose(difference); + } +}, { immediate: true });