Skip to content

Commit

Permalink
Merge pull request #29 from mactkg/stop-record-by-esc
Browse files Browse the repository at this point in the history
Stop recording with esc key
  • Loading branch information
neauoire authored Apr 22, 2019
2 parents ecc0e41 + ba0a819 commit 526d678
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions desktop/sources/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@
controller.add("default","Theme","Download Themes..",() => { require('electron').shell.openExternal('https://github.com/hundredrabbits/Themes') })

controller.commit()

document.body.addEventListener('keydown', e => {
switch(e.keyCode) {
case 27: // Esc
e.preventDefault()
pilot.recorder.stop()
break
}
})

pilot.install(document.body)
pilot.start()
Expand Down
2 changes: 2 additions & 0 deletions desktop/sources/scripts/recorder.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ function Recorder (pilot) {
}

this.stop = function () {
if(!this.isRecording) { return }

console.log('Recorder', 'Stopping..')
this.isRecording = false
pilot.mixer.recorder.stop()
Expand Down

0 comments on commit 526d678

Please sign in to comment.