Skip to content

Commit

Permalink
limit max and minimum frame for dragging
Browse files Browse the repository at this point in the history
  • Loading branch information
PythonFZ committed Aug 20, 2024
1 parent 6ea658f commit f4cc100
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/src/components/progressbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ const FrameProgressBar: React.FC<FrameProgressBarProps> = ({
// 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);
Expand Down

0 comments on commit f4cc100

Please sign in to comment.