Skip to content

Commit e89bb32

Browse files
committed
fix: mobile volume tap works again
1 parent 6f6f0c4 commit e89bb32

1 file changed

Lines changed: 6 additions & 11 deletions

File tree

src/layouts/default/PlayerOSD/PlayerVolume.vue

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -530,18 +530,13 @@ const onTouchEnd = (event: TouchEvent) => {
530530
if (hasGroupPopout.value) {
531531
toggleGroupPopout();
532532
} else {
533-
// Single player: tap before/after handle for volume up/down
533+
// Single player: jump to the tapped position (absolute), matching the
534+
// desktop click behaviour instead of stepping volume up/down.
534535
const touch = event.changedTouches[0];
535-
const thumb = sliderContainerRef.value?.querySelector("[role=slider]");
536-
if (thumb) {
537-
const thumbRect = thumb.getBoundingClientRect();
538-
const thumbCenter = thumbRect.left + thumbRect.width / 2;
539-
if (touch.clientX > thumbCenter) {
540-
volumeUp();
541-
} else {
542-
volumeDown();
543-
}
544-
}
536+
const finalValue = getPercentageFromX(touch.clientX);
537+
displayValue.value = finalValue;
538+
emit("update:local-value", finalValue);
539+
setVolume(finalValue);
545540
}
546541
} else {
547542
// Drag end: send the final absolute value to the server

0 commit comments

Comments
 (0)