aboutsummaryrefslogtreecommitdiffstats
path: root/app/app.js
diff options
context:
space:
mode:
authors-ol <s+removethis@s-ol.nu>2022-01-04 12:16:31 +0000
committers-ol <s+removethis@s-ol.nu>2022-01-04 12:16:31 +0000
commit2341addccd53f81248a615f44b58d5588eae3eba (patch)
treeba04e99e9fc26802f0662ef3c63cbb3598907cc8 /app/app.js
parentadd chord display (diff)
downloadisomorphic-kb-explorer-2341addccd53f81248a615f44b58d5588eae3eba.tar.gz
isomorphic-kb-explorer-2341addccd53f81248a615f44b58d5588eae3eba.zip
fix keyboard mapping
Diffstat (limited to 'app/app.js')
-rw-r--r--app/app.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/app.js b/app/app.js
index 172a908..00b18bb 100644
--- a/app/app.js
+++ b/app/app.js
@@ -192,17 +192,23 @@ export default class App extends React.Component {
}
onkeydown = (e) => {
+ if (e.repeat) return;
+
const note = notes.key2midi[e.code];
if (!note) return;
e.preventDefault();
this.setState(({ notes }) => ({ notes: { ...notes, [note]: true } }));
+ this.send(NOTE_ON, note);
}
onkeyup = (e) => {
+ if (e.repeat) return;
+
const note = notes.key2midi[e.code];
if (!note) return;
e.preventDefault();
this.setState(({ notes }) => ({ notes: { ...notes, [note]: false } }));
+ this.send(NOTE_OFF, note);
}
render() {