update: index.tsx

This commit is contained in:
alikia2x (寒寒) 2025-01-01 18:46:49 +08:00
parent 408778b8b9
commit 628fcc9359
Signed by: alikia2x
GPG Key ID: 56209E0CCD8420C6

View File

@ -39,6 +39,7 @@ function Image({ src }: { src: string }) {
);
}
// TODO: Memory optimization
export default function RewindPage() {
const { port, apiKey } = useAtomValue(apiInfoAtom);
const [timeline, setTimeline] = useState<Frame[]>([]);
@ -168,9 +169,9 @@ export default function RewindPage() {
const handleScroll = (e: React.WheelEvent) => {
if (!containerRef.current || !currentFrameId) return;
// Only allow scroll changes every 80ms
// Only allow scroll changes every 30ms
const now = Date.now();
if (now - lastScrollTime.current < 80) return;
if (now - lastScrollTime.current < 30) return;
lastScrollTime.current = now;
const delta = Math.sign(e.deltaY);