Better idle mouse hiding implementation (#3214)

This commit is contained in:
absidue 2023-02-26 04:01:20 +01:00 committed by GitHub
parent 8a3ca07c06
commit 5d9383b67b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 23 deletions

View File

@ -6,6 +6,10 @@
width:100%;
}
.ftVideoPlayer.vjs-user-inactive {
cursor: none;
}
:deep(.sponsorBlockMarker), :deep(.chapterMarker) {
position: absolute;
opacity: 0.6;

View File

@ -28,7 +28,6 @@ export default defineComponent({
if (this.player !== null && !this.player.isInPictureInPicture()) {
this.player.dispose()
this.player = null
clearTimeout(this.mouseTimeout)
} else if (this.player.isInPictureInPicture()) {
this.player.play()
}
@ -102,8 +101,6 @@ export default defineComponent({
maxFramerate: 0,
activeSourceList: [],
activeAdaptiveFormats: [],
mouseTimeout: null,
touchTimeout: null,
playerStats: null,
statsModal: null,
showStatsModal: false,
@ -341,7 +338,6 @@ export default defineComponent({
if (!this.player.isInPictureInPicture()) {
this.player.dispose()
this.player = null
clearTimeout(this.mouseTimeout)
}
}
@ -468,9 +464,6 @@ export default defineComponent({
document.removeEventListener('keydown', this.keyboardShortcutHandler)
document.addEventListener('keydown', this.keyboardShortcutHandler)
this.player.on('mousemove', this.hideMouseTimeout)
this.player.on('mouseleave', this.removeMouseTimeout)
this.player.on('volumechange', this.updateVolume)
if (this.videoVolumeMouseScroll) {
this.player.on('wheel', this.mouseScrollVolume)
@ -1694,22 +1687,6 @@ export default defineComponent({
}
},
hideMouseTimeout: function () {
if (typeof this.$refs.video !== 'undefined') {
this.$refs.video.style.cursor = 'default'
clearTimeout(this.mouseTimeout)
this.mouseTimeout = setTimeout(() => {
this.$refs.video.style.cursor = 'none'
}, 2650)
}
},
removeMouseTimeout: function () {
if (this.mouseTimeout !== null) {
clearTimeout(this.mouseTimeout)
}
},
fullscreenOverlay: function () {
const title = document.title.replace('- FreeTube', '')