From f4cc1002ace3604b58d3c8a016a8ecefee56923d Mon Sep 17 00:00:00 2001 From: Fabian Zills Date: Tue, 20 Aug 2024 11:00:22 +0200 Subject: [PATCH] limit max and minimum frame for dragging --- app/src/components/progressbar.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/components/progressbar.tsx b/app/src/components/progressbar.tsx index 704eec02..5eb6dd78 100644 --- a/app/src/components/progressbar.tsx +++ b/app/src/components/progressbar.tsx @@ -300,7 +300,7 @@ const FrameProgressBar: React.FC = ({ // compute the lineposition based on the mouse position and the length const x = e.clientX - parentRect.left; const position = Math.floor((x / parentRect.width) * length); - setStep(Math.max(0, position)); + setStep(Math.min(Math.max(position, 0), length - 1)); }; document.addEventListener("mousemove", handleMouseMove);