Merge pull request #16 from benwiley4000/click-listener

Clicking in the window re-captures the mouse.
This commit is contained in:
Felix Rieseberg 2018-08-23 16:00:51 -07:00 committed by GitHub
commit c11ae3caea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -55,6 +55,7 @@ async function main (id) {
function start (id) {
BUTTONS.remove()
document.body.className = ''
setupClickListener()
main(id)
}
@ -135,6 +136,15 @@ function setupCloseListener () {
}
}
function setupClickListener () {
document.addEventListener('click', () => {
if (!cursorCaptured) {
cursorCaptured = true
window.emulator.lock_mouse()
}
})
}
setupEscListener()
setupCloseListener()
setupButtons()