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

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()