mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-20 20:21: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();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -10,6 +10,8 @@ import setting from './setting.svg';
|
||||
import fullscreen from './fullscreen.svg';
|
||||
import fullscreenWeb from './fullscreen-web.svg';
|
||||
import pip from './pip.svg';
|
||||
import prev from './prev.svg';
|
||||
import next from './next.svg';
|
||||
|
||||
const icons = {
|
||||
loading,
|
||||
@@ -23,7 +25,9 @@ const icons = {
|
||||
setting,
|
||||
fullscreen,
|
||||
fullscreenWeb,
|
||||
pip
|
||||
pip,
|
||||
prev,
|
||||
next
|
||||
};
|
||||
|
||||
function creatDomFromSvg(map) {
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="36" width="36" viewBox="0 0 36 36">
|
||||
<path d="M 12,24 20.5,18 12,12 V 24 z M 22,12 v 12 h 2 V 12 h -2 z"></path>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 170 B |
@@ -0,0 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="36" width="36" viewBox="0 0 36 36">
|
||||
<path d="m 12,12 h 2 v 12 h -2 z m 3.5,6 8.5,6 V 12 z"></path>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 157 B |
Reference in new issue
Block a user