diff --git a/src/components/PlaybackControls/index.tsx b/src/components/PlaybackControls/index.tsx index e4c92cf0..066fc58a 100644 --- a/src/components/PlaybackControls/index.tsx +++ b/src/components/PlaybackControls/index.tsx @@ -49,36 +49,8 @@ const PlayBackControls = ({ timeUnits, isEmpty, }: PlayBackProps): JSX.Element => { - // Where to resume playing if simulation was playing before scrubbing - const [timeToResumeAfterScrubbing, setTimeToResumeAfterScrubbing] = - useState(-1); const [timeInput, setTimeInput] = useState(firstFrameTime); - // - Gets called once when the user clicks on the slider to skip to a specific time - // - Gets called multiple times when user is scrubbing (every time the play head - // passes through a time value associated with a frame) - const handleTimeChange = (sliderValue: number): void => { - onTimeChange(sliderValue); - if (isPlaying) { - // Need to save the sliderValue as timeToResumeAfterScrubbing to use in handleSliderMouseUp, - // because the sliderValue argument available in handleSliderMouseUp is not accurate - // when the time between mouse down and mouse up is short. - setTimeToResumeAfterScrubbing(sliderValue); - pauseHandler(); - } else if (timeToResumeAfterScrubbing >= 0) { - // Update value if user is still dragging - setTimeToResumeAfterScrubbing(sliderValue); - } - }; - - const handleSliderMouseUp = (): void => { - // Resume playing if simulation was playing before - if (timeToResumeAfterScrubbing >= 0) { - playHandler(timeToResumeAfterScrubbing); - setTimeToResumeAfterScrubbing(-1); - } - }; - // Called after every keystroke const handleTimeInputChange = (userInput: number | null): void => { if (userInput !== null) { @@ -148,8 +120,7 @@ const PlayBackControls = ({ { lastFrameTime, timeStep, isBuffering, - setBuffering, } = this.props; if (isBuffering) { return; @@ -361,8 +360,6 @@ class ViewerPanel extends React.Component { if (isTimeGreaterThanLastFrameTime || isTimeLessThanFirstFrameTime) { return; } - - setBuffering(true); simulariumController.gotoTime(time); }