Skip to content

Commit

Permalink
App: Hide mouse if not moving for 5 seconds
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick José Pereira <[email protected]>
  • Loading branch information
patrickelectric committed Oct 18, 2023
1 parent c38bfe0 commit f091e40
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,21 @@ const showMissionOptionsDialog = ref(false)
// Clock
const timeNow = useTimestamp({ interval: 1000 })
// Control showing mouse
let hideMouseTimeoutId: ReturnType<typeof setInterval>
const hideMouse = (): void => {
document.body.classList.add('hide-cursor')
}
const resetHideMouseTimeout = (): void => {
clearTimeout(hideMouseTimeoutId)
document.body.classList.remove('hide-cursor')
hideMouseTimeoutId = setTimeout(hideMouse, 5000)
}
document.addEventListener('mousemove', resetHideMouseTimeout)
</script>

<style>
Expand All @@ -174,6 +189,9 @@ body {
/* Removes the scrollbar */
overflow: hidden !important;
}
body.hide-cursor {
cursor: none;
}
.router-view {
width: 100%;
height: 100%;
Expand Down

0 comments on commit f091e40

Please sign in to comment.