Skip to content

Commit

Permalink
add volume test sim to viewer test ui
Browse files Browse the repository at this point in the history
  • Loading branch information
frasercl committed Sep 11, 2024
1 parent 2d4cc69 commit 3e1ec28
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions examples/src/Viewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import PointSimulatorLive from "./simulators/PointSimulatorLive";
import PdbSimulator from "./simulators/PdbSimulator";
import SinglePdbSimulator from "./simulators/SinglePdbSimulator";
import CurveSimulator from "./simulators/CurveSimulator";
import VolumeSimulator from "./simulators/VolumeSimulator";
import SingleCurveSimulator from "./simulators/SingleCurveSimulator";
import ColorPicker from "./ColorPicker";
import RecordMovieComponent from "./RecordMovieComponent";
Expand Down Expand Up @@ -388,16 +389,21 @@ class Viewer extends React.Component<InputParams, ViewerState> {
public convertFile(obj: Record<string, any>, fileType: TrajectoryType) {
const fileName = uuidv4() + ".simularium";
simulariumController
.convertTrajectory(this.netConnectionSettings, obj, fileType, fileName)
.convertTrajectory(
this.netConnectionSettings,
obj,
fileType,
fileName
)
.then(() => {
this.clearPendingFile();
})
.then(() => {
simulariumController.changeFile(
{ netConnectionSettings: this.netConnectionSettings, },
{ netConnectionSettings: this.netConnectionSettings },
fileName,
true,
)
true
);
})
.catch((err) => {
console.error(err);
Expand All @@ -412,7 +418,7 @@ class Viewer extends React.Component<InputParams, ViewerState> {
const simulariumFile = fileName.includes(".simularium")
? trajectoryFile
: null;
this.setState({ initialPlay: true})
this.setState({ initialPlay: true });
return simulariumController
.handleFileChange(simulariumFile, fileName, geoAssets)
.catch(console.log);
Expand Down Expand Up @@ -629,6 +635,13 @@ class Viewer extends React.Component<InputParams, ViewerState> {
},
playbackFile
);
} else if (playbackFile === "TEST_VOLUME") {
simulariumController.changeFile(
{
clientSimulator: new VolumeSimulator(),
},
playbackFile
);
} else {
this.setState({
simulariumFile: { name: playbackFile, data: null },
Expand Down Expand Up @@ -783,6 +796,7 @@ class Viewer extends React.Component<InputParams, ViewerState> {
<option value="TEST_POINTS">TEST POINTS</option>
<option value="TEST_METABALLS">TEST METABALLS</option>
<option value="TEST_BINDING">TEST BINDING</option>
<option value="TEST_VOLUME">TEST VOLUME</option>
</select>

<button onClick={() => this.translateAgent()}>
Expand Down

0 comments on commit 3e1ec28

Please sign in to comment.