mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-20 04:01:20 -08:00
优化隐藏光标
This commit is contained in:
1 parent
5c037ad08f
commit
4ecdb6b2d9
6 files changed
+33
-28
No files matched your search
@@ -3,30 +3,24 @@ import { debounce } from '../utils';
|
||||
export default function mousemoveInitInit(art, events) {
|
||||
const { refs: { $player } } = art;
|
||||
|
||||
const hideCursor = debounce(() => {
|
||||
const autoHide = debounce(() => {
|
||||
$player.classList.add('artplayer-hide-cursor');
|
||||
}, 5000);
|
||||
|
||||
const hideControl = debounce(() => {
|
||||
$player.classList.remove('artplayer-hover');
|
||||
art.controls.hide();
|
||||
}, 5000);
|
||||
|
||||
art.on('hoverleave', () => {
|
||||
hideControl();
|
||||
hideCursor.clearTimeout();
|
||||
$player.classList.remove('artplayer-hide-cursor');
|
||||
if (art.isPlaying) {
|
||||
autoHide();
|
||||
}
|
||||
});
|
||||
|
||||
events.proxy($player, 'mousemove', () => {
|
||||
hideControl.clearTimeout();
|
||||
art.controls.show();
|
||||
autoHide.clearTimeout();
|
||||
$player.classList.remove('artplayer-hide-cursor');
|
||||
art.controls.show();
|
||||
if (!art.player.pipState) {
|
||||
hideCursor();
|
||||
} else {
|
||||
hideCursor.clearTimeout();
|
||||
if (!art.player.pipState && art.isPlaying) {
|
||||
autoHide();
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user