diff options
| author | Brian Cully <bjc@spork.org> | 2025-07-28 08:52:51 -0400 |
|---|---|---|
| committer | Brian Cully <bjc@spork.org> | 2025-07-28 08:52:51 -0400 |
| commit | 77f5e81d0a1adc497040eaa89095635f3de3924e (patch) | |
| tree | 4ad6a00edf5cfe3c5c2bf0090ba80f8d13c143cc /fretboard.mjs | |
| parent | 2d12e407ccac850dd2e1ce133a2f335677a2ef29 (diff) | |
| download | chords-77f5e81d0a1adc497040eaa89095635f3de3924e.tar.gz chords-77f5e81d0a1adc497040eaa89095635f3de3924e.zip | |
attach octave values to frets
sometimes just do the simple thing
Diffstat (limited to 'fretboard.mjs')
| -rw-r--r-- | fretboard.mjs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/fretboard.mjs b/fretboard.mjs index 9c25ff6..cae94ec 100644 --- a/fretboard.mjs +++ b/fretboard.mjs @@ -82,6 +82,12 @@ export default class extends HTMLElement { }); } + get tonics() { + return Array.from(this.querySelectorAll('x-string')).map(elt => { + return elt.getAttribute('tonic'); + }); + } + get octaves() { return Array.from(this.querySelectorAll('x-string')).map(elt => { return Number(elt.getAttribute('octave')); @@ -140,8 +146,9 @@ export default class extends HTMLElement { item.querySelectorAll('[slot="string"]').forEach(s => { console.debug(' -- setting tonic', tonic, 'on', s); s.setAttribute('tonic', tonic); - s.setAttribute('octave', octave); + s.setAttribute('tonic-octave', octave); s.setAttribute('value', tonic); + s.setAttribute('octave', octave); s.setAttribute('frets', frets.toString()); }) tmpl.parentNode.insertBefore(item, tmpl); |
