Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

won't show time controls if there is no time range #343

Merged
merged 1 commit into from
May 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 18 additions & 16 deletions src/containers/ViewerPanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -392,22 +392,24 @@ class ViewerPanel extends React.Component<ViewerPanelProps, ViewerPanelState> {
this.onTrajectoryFileInfoChanged
}
/>
<PlaybackControls
playHandler={this.startPlay}
time={time}
timeStep={timeStep}
displayTimes={displayTimes}
timeUnits={timeUnits}
onTimeChange={this.skipToTime}
pauseHandler={this.pause}
prevHandler={this.playBackOne}
nextHandler={this.playForwardOne}
isPlaying={isPlaying}
firstFrameTime={firstFrameTime}
lastFrameTime={lastFrameTime}
loading={isBuffering}
isEmpty={status === VIEWER_EMPTY}
/>
{firstFrameTime !== lastFrameTime && (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i wonder if there is a better check, like count of number of frames === 1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, this component doesn't know the total number, and I didn't investigate when/if that gets sent in. I don't see any way this would be wrong when the count would be right though

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's the opposite case i'd be worried about: when num frames > 1 but each frame has the same frame time (or within floating point equality)

<PlaybackControls
playHandler={this.startPlay}
time={time}
timeStep={timeStep}
displayTimes={displayTimes}
timeUnits={timeUnits}
onTimeChange={this.skipToTime}
pauseHandler={this.pause}
prevHandler={this.playBackOne}
nextHandler={this.playForwardOne}
isPlaying={isPlaying}
firstFrameTime={firstFrameTime}
lastFrameTime={lastFrameTime}
loading={isBuffering}
isEmpty={status === VIEWER_EMPTY}
/>
)}
<ScaleBar label={scaleBarLabel} />
<CameraControls
resetCamera={simulariumController.resetCamera}
Expand Down