Fix double press to skip 10s on web

This commit is contained in:
Zoe Roux 2024-02-18 01:07:51 +01:00
parent 2a3d5de54b
commit 7adbb5d299

View File

@ -265,7 +265,7 @@ export const HoverTouch = ({ children, ...props }: { children: ReactNode }) => {
const onAnyPress = (e: { pointerType: string; x: number }) => { const onAnyPress = (e: { pointerType: string; x: number }) => {
touch.current.count++; touch.current.count++;
if (touch.current.count >= 2) { if (touch.current.count == 2) {
onDoublePress(e); onDoublePress(e);
clearTimeout(touch.current.timeout); clearTimeout(touch.current.timeout);
} else { } else {
@ -286,7 +286,7 @@ export const HoverTouch = ({ children, ...props }: { children: ReactNode }) => {
}} }}
onPress={(e) => { onPress={(e) => {
e.preventDefault(); e.preventDefault();
onAnyPress({ pointerType: isTouch ? "touch" : "mouse", x: e.nativeEvent.locationX }); onAnyPress({ pointerType: isTouch ? "touch" : "mouse", x: e.nativeEvent.locationX ?? e.nativeEvent.pageX });
}} }}
onLayout={(e) => { onLayout={(e) => {
playerWidth.current = e.nativeEvent.layout.width; playerWidth.current = e.nativeEvent.layout.width;