diff options
| author | s-ol <s+removethis@s-ol.nu> | 2022-01-04 12:16:31 +0000 |
|---|---|---|
| committer | s-ol <s+removethis@s-ol.nu> | 2022-01-04 12:16:31 +0000 |
| commit | 2341addccd53f81248a615f44b58d5588eae3eba (patch) | |
| tree | ba04e99e9fc26802f0662ef3c63cbb3598907cc8 /app/app.js | |
| parent | add chord display (diff) | |
| download | isomorphic-kb-explorer-2341addccd53f81248a615f44b58d5588eae3eba.tar.gz isomorphic-kb-explorer-2341addccd53f81248a615f44b58d5588eae3eba.zip | |
fix keyboard mapping
Diffstat (limited to 'app/app.js')
| -rw-r--r-- | app/app.js | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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() { |
