mirror of
https://github.com/movie-web/movie-web.git
synced 2024-11-14 18:55:10 +01:00
Merge pull request #1011 from qtchaos/fix/scroll-volume
Add `touch-action: none` to resolve touchpad scrolling issues on volume slider.
This commit is contained in:
commit
21fd5304a1
@ -41,8 +41,13 @@ export function Volume(props: Props) {
|
|||||||
|
|
||||||
const handleMouseEnter = useCallback(async () => {
|
const handleMouseEnter = useCallback(async () => {
|
||||||
if (await canChangeVolume()) setHovering(true);
|
if (await canChangeVolume()) setHovering(true);
|
||||||
|
document.body.classList.add("overflow-y-hidden");
|
||||||
}, [setHovering]);
|
}, [setHovering]);
|
||||||
|
|
||||||
|
const handleMouseLeave = () => {
|
||||||
|
document.body.classList.remove("overflow-y-hidden");
|
||||||
|
};
|
||||||
|
|
||||||
let percentage = makePercentage(volume * 100);
|
let percentage = makePercentage(volume * 100);
|
||||||
if (dragging) percentage = makePercentage(dragPercentage);
|
if (dragging) percentage = makePercentage(dragPercentage);
|
||||||
const percentageString = makePercentageString(percentage);
|
const percentageString = makePercentageString(percentage);
|
||||||
@ -61,9 +66,10 @@ export function Volume(props: Props) {
|
|||||||
<div
|
<div
|
||||||
className={props.className}
|
className={props.className}
|
||||||
onMouseEnter={handleMouseEnter}
|
onMouseEnter={handleMouseEnter}
|
||||||
|
onMouseLeave={handleMouseLeave}
|
||||||
onWheel={handleWheel}
|
onWheel={handleWheel}
|
||||||
>
|
>
|
||||||
<div className="pointer-events-auto flex cursor-pointer items-center py-0">
|
<div className="pointer-events-auto flex cursor-pointer items-center py-0 touch-none">
|
||||||
<div className="px-4 text-2xl text-white" onClick={handleClick}>
|
<div className="px-4 text-2xl text-white" onClick={handleClick}>
|
||||||
<Icon icon={percentage > 0 ? Icons.VOLUME : Icons.VOLUME_X} />
|
<Icon icon={percentage > 0 ? Icons.VOLUME : Icons.VOLUME_X} />
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user