summaryrefslogtreecommitdiffstats
path: root/key-picker.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'key-picker.mjs')
-rw-r--r--key-picker.mjs18
1 files changed, 18 insertions, 0 deletions
diff --git a/key-picker.mjs b/key-picker.mjs
index 431fdcd..3b4a378 100644
--- a/key-picker.mjs
+++ b/key-picker.mjs
@@ -11,6 +11,24 @@ function scaleFrom(tonic, scale) {
}
}
+function handleNoteEnter(e) {
+ const n = e.target.innerText;
+ // todo: this should be delegated. the key selector shouldn't know
+ // about the fretboard at all.
+ document.querySelectorAll(`#fretboard [x-data-note="${n}"]`).forEach(elt => {
+ console.debug('wow! found elt', elt);
+ elt.classList.add('hover');
+ })
+}
+function handleNoteLeave(e) {
+ const n = e.target.innerText;
+ // ibid.
+ document.querySelectorAll(`#fretboard [x-data-note="${n}"]`).forEach(elt => {
+ console.debug('wow! found elt', elt);
+ elt.classList.remove('hover');
+ })
+}
+
function formChanged(form) {
const formData = new FormData(form);
const scale = scaleFrom(formData.get('tonic'), formData.get('scale'));