Skip to content

Commit

Permalink
Add enter to play, and space to pause if playing.
Browse files Browse the repository at this point in the history
 * As per issue #67.
  • Loading branch information
pgregory committed Feb 9, 2017
1 parent 2013887 commit 6153a8d
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,24 @@ $(document).ready(() => {
$('#instruments-view').append($(instrumentsViewTemplate.renderToString()));

MouseTrap.bind("space", (e) => {
state.set({
cursor: {
record: !state.cursor.get("record"),
}
});
if(player.playing) {
player.pause();
} else {
state.set({
cursor: {
record: !state.cursor.get("record"),
}
});
}
e.preventDefault();
});

MouseTrap.bind("enter", (e) => {
if(!player.playing) {
player.play();
} else {
player.pause();
}
e.preventDefault();
});

Expand Down

0 comments on commit 6153a8d

Please sign in to comment.