fix mobile control click event

This commit is contained in:
Harvey committed 2022-09-26 08:56:34 +08:00
1 parent 0f99168529
commit 86d083dcc2
4 files changed
+29 -10

No files matched your search

+13 -4
View File
@@ -127,15 +127,24 @@ export default function progress(options) {
setBar('played', 1);
});
if (!isMobile) {
proxy($control, 'click', (event) => {
if (event.target !== $indicator) {
proxy($control, 'click', (event) => {
if (event.target !== $indicator) {
const autoOrientation = art.plugins.autoOrientation && art.plugins.autoOrientation.state;
if (autoOrientation) {
const { clientHeight } = document.documentElement;
const percentage = event.pageY / clientHeight;
const second = percentage * art.duration;
setBar('played', percentage);
art.seek = second;
} else {
const { second, percentage } = getPosFromEvent(art, event);
setBar('played', percentage);
art.seek = second;
}
});
}
});
if (!isMobile) {
proxy($control, 'mousemove', (event) => {
setStyle($tip, 'display', 'block');
if (includeFromEvent(event, $highlight)) {