mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-20 20:21:20 -08:00
Optimize setBar event and reduce delay for hiding chapter title in artplayer-plugin-chapter
This commit is contained in:
1 parent
e8d7ae91f0
commit
94e34320e0
6 files changed
+20
-13
No files matched your search
@@ -74,7 +74,7 @@ export default function artplayerPluginChapter({ chapters = [] }) {
|
||||
clearTimeout(titleTimer);
|
||||
titleTimer = setTimeout(() => {
|
||||
setStyle($title, 'display', 'none');
|
||||
}, 1000);
|
||||
}, 500);
|
||||
}
|
||||
} else {
|
||||
if (type === 'hover') {
|
||||
|
||||
@@ -71,8 +71,8 @@ export default function progress(options) {
|
||||
}
|
||||
}
|
||||
|
||||
function showTime(event) {
|
||||
const { width, time } = getPosFromEvent(art, event);
|
||||
function showTime(event, touch) {
|
||||
const { width, time } = touch || getPosFromEvent(art, event);
|
||||
$tip.innerText = time;
|
||||
const tipWidth = $tip.clientWidth;
|
||||
if (width <= tipWidth / 2) {
|
||||
@@ -99,11 +99,13 @@ export default function progress(options) {
|
||||
|
||||
if (isMobile && event) {
|
||||
setStyle($tip, 'display', 'flex');
|
||||
showTime(event);
|
||||
const width = $control.clientWidth * percentage;
|
||||
const time = secondToTime(percentage * art.duration);
|
||||
showTime(event, { width, time });
|
||||
clearTimeout(tipTimer);
|
||||
tipTimer = setTimeout(() => {
|
||||
setStyle($tip, 'display', 'none');
|
||||
}, 1000);
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user