mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 21:04:37 +03:00
Revert scrubber debounce (#1428)
This commit is contained in:
@@ -6,9 +6,7 @@ import React, {
|
|||||||
useRef,
|
useRef,
|
||||||
useState,
|
useState,
|
||||||
useCallback,
|
useCallback,
|
||||||
useMemo,
|
|
||||||
} from "react";
|
} from "react";
|
||||||
import { debounce } from "lodash";
|
|
||||||
import { Button } from "react-bootstrap";
|
import { Button } from "react-bootstrap";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import * as GQL from "src/core/generated-graphql";
|
import * as GQL from "src/core/generated-graphql";
|
||||||
@@ -82,10 +80,6 @@ export const ScenePlayerScrubber: React.FC<IScenePlayerScrubberProps> = (
|
|||||||
const velocity = useRef(0);
|
const velocity = useRef(0);
|
||||||
|
|
||||||
const _position = useRef(0);
|
const _position = useRef(0);
|
||||||
const onSeek = useMemo(() => debounce(props.onSeek, 1000), [props.onSeek]);
|
|
||||||
const onScrolled = useMemo(() => debounce(props.onScrolled, 1000), [
|
|
||||||
props.onScrolled,
|
|
||||||
]);
|
|
||||||
const getPosition = useCallback(() => _position.current, []);
|
const getPosition = useCallback(() => _position.current, []);
|
||||||
const setPosition = useCallback(
|
const setPosition = useCallback(
|
||||||
(newPostion: number, shouldEmit: boolean = true) => {
|
(newPostion: number, shouldEmit: boolean = true) => {
|
||||||
@@ -93,7 +87,7 @@ export const ScenePlayerScrubber: React.FC<IScenePlayerScrubberProps> = (
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (shouldEmit) {
|
if (shouldEmit) {
|
||||||
onScrolled();
|
props.onScrolled();
|
||||||
}
|
}
|
||||||
|
|
||||||
const midpointOffset = scrubberSliderEl.current.clientWidth / 2;
|
const midpointOffset = scrubberSliderEl.current.clientWidth / 2;
|
||||||
@@ -114,7 +108,7 @@ export const ScenePlayerScrubber: React.FC<IScenePlayerScrubberProps> = (
|
|||||||
scrubberSliderEl.current.clientWidth;
|
scrubberSliderEl.current.clientWidth;
|
||||||
positionIndicatorEl.current.style.transform = `translateX(${indicatorPosition}px)`;
|
positionIndicatorEl.current.style.transform = `translateX(${indicatorPosition}px)`;
|
||||||
},
|
},
|
||||||
[onScrolled]
|
[props]
|
||||||
);
|
);
|
||||||
|
|
||||||
const [spriteItems, setSpriteItems] = useState<ISceneSpriteItem[]>([]);
|
const [spriteItems, setSpriteItems] = useState<ISceneSpriteItem[]>([]);
|
||||||
@@ -209,7 +203,7 @@ export const ScenePlayerScrubber: React.FC<IScenePlayerScrubberProps> = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (seekSeconds) {
|
if (seekSeconds) {
|
||||||
onSeek(seekSeconds);
|
props.onSeek(seekSeconds);
|
||||||
}
|
}
|
||||||
} else if (Math.abs(velocity.current) > 25) {
|
} else if (Math.abs(velocity.current) > 25) {
|
||||||
const newPosition = getPosition() + velocity.current * 10;
|
const newPosition = getPosition() + velocity.current * 10;
|
||||||
|
|||||||
Reference in New Issue
Block a user