+
diff --git a/examples/src/Viewer.tsx b/examples/src/Viewer.tsx
index 3f10b358..f5fa2fb4 100644
--- a/examples/src/Viewer.tsx
+++ b/examples/src/Viewer.tsx
@@ -1,23 +1,7 @@
import React from "react";
-import { isEqual, findIndex, map, reduce } from "lodash";
+import { isEqual, findIndex, reduce } from "lodash";
import { v4 as uuidv4 } from "uuid";
-
-import type {
- ISimulariumFile,
- UIDisplayData,
- SelectionStateInfo,
- SelectionEntry,
-} from "../../type-declarations";
-import { nullAgent, TrajectoryType } from "../../src/constants";
-import SimulariumViewer, {
- SimulariumController,
- RenderStyle,
- loadSimulariumFile,
- FrontEndError,
- ErrorLevel,
- NetConnectionParams,
- TrajectoryFileInfo,
-} from "../../src/index";
+import { InputParams } from "tweakpane";
/**
* NOTE: if you are debugging an import/build issue
@@ -32,7 +16,23 @@ import SimulariumViewer, {
// FrontEndError,
// ErrorLevel,
// } from "../es";
-import "../../style/style.css";
+import SimulariumViewer, {
+ SimulariumController,
+ RenderStyle,
+ loadSimulariumFile,
+ FrontEndError,
+ ErrorLevel,
+ NetConnectionParams,
+ TrajectoryFileInfo,
+} from "../../src/index";
+import { nullAgent, TrajectoryType } from "../../src/constants";
+
+import type {
+ ISimulariumFile,
+ UIDisplayData,
+ SelectionStateInfo,
+ SelectionEntry,
+} from "../../type-declarations";
import { AgentData } from "../../type-declarations/simularium/types";
import PointSimulator from "./simulators/PointSimulator";
import BindingSimulator from "./simulators/BindingSimulator2D";
@@ -41,8 +41,15 @@ import PdbSimulator from "./simulators/PdbSimulator";
import SinglePdbSimulator from "./simulators/SinglePdbSimulator";
import CurveSimulator from "./simulators/CurveSimulator";
import SingleCurveSimulator from "./simulators/SingleCurveSimulator";
-import ColorPicker from "./ColorPicker";
-import RecordMovieComponent from "./RecordMovieComponent";
+import MetaballSimulator from "./simulators/MetaballSimulator";
+
+import ColorPicker from "./Components/ColorPicker";
+import RecordMovieComponent from "./Components/RecordMovieComponent";
+import ConversionForm from "./Components/ConversionForm";
+import AgentMetadata from "./Components/AgentMetadata";
+
+import { agentColors } from "./constants";
+import { BaseType, CustomType } from "./types";
import {
SMOLDYN_TEMPLATE,
UI_BASE_TYPES,
@@ -50,9 +57,9 @@ import {
UI_TEMPLATE_DOWNLOAD_URL_ROOT,
UI_TEMPLATE_URL_ROOT,
} from "./api-settings";
-import ConversionForm from "./ConversionForm";
-import MetaballSimulator from "./simulators/MetaballSimulator";
-import AgentMetadata from "./AgentMetadata";
+
+import "../../style/style.css";
+import "./style.css";
let playbackFile = "TEST_LIVEMODE_API";
let queryStringFile = "";
@@ -62,26 +69,6 @@ if (urlParams.has("file")) {
playbackFile = queryStringFile;
}
-const agentColors = [
- "#fee34d",
- "#f7b232",
- "#bf5736",
- "#94a7fc",
- "#ce8ec9",
- "#58606c",
- "#0ba345",
- "#9267cb",
- "#81dbe6",
- "#bd7800",
- "#bbbb99",
- "#5b79f0",
- "#89a500",
- "#da8692",
- "#418463",
- "#9f516c",
- "#00aabf",
-];
-
interface ViewerState {
renderStyle: RenderStyle;
particleTypeNames: string[];
@@ -113,34 +100,6 @@ interface ViewerState {
followObjectData: AgentData;
}
-interface BaseType {
- isBaseType: true;
- id: string;
- data: string;
- match: string;
-}
-
-export interface CustomParameters {
- name: string;
- data_type: string;
- description: string;
- required: boolean;
- help: string;
- options?: string[];
-}
-
-interface CustomType {
- [key: string]: {
- "python::module": string;
- "python::object": string;
- parameters: CustomParameters;
- };
-}
-
-interface InputParams {
- localBackendServer: boolean;
-}
-
const simulariumController = new SimulariumController({});
let currentFrame = 0;
@@ -386,16 +345,21 @@ class Viewer extends React.Component
{
public convertFile(obj: Record, 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);
@@ -410,7 +374,7 @@ class Viewer extends React.Component {
const simulariumFile = fileName.includes(".simularium")
? trajectoryFile
: null;
- this.setState({ initialPlay: true})
+ this.setState({ initialPlay: true });
return simulariumController
.handleFileChange(simulariumFile, fileName, geoAssets)
.catch(console.log);
@@ -507,13 +471,18 @@ class Viewer extends React.Component {
[]
);
const uniqueTags: string[] = [...new Set(allTags)];
- if (isEqual(uiDisplayData, this.state.selectionStateInfo.appliedColors)) {
+ if (
+ isEqual(uiDisplayData, this.state.selectionStateInfo.appliedColors)
+ ) {
return;
}
this.setState({
particleTypeNames: uiDisplayData.map((a) => a.name),
particleTypeTags: uniqueTags,
- selectionStateInfo: {...initialState.selectionStateInfo, appliedColors: uiDisplayData},
+ selectionStateInfo: {
+ ...initialState.selectionStateInfo,
+ appliedColors: uiDisplayData,
+ },
});
}
@@ -978,24 +947,16 @@ class Viewer extends React.Component {
updateAgentColorArray={this.updateAgentColorArray}
setColorSelectionInfo={this.setColorSelectionInfo}
/>
-
- {this.state.isRecordingEnabled && (
-
- )}
+ {
+ this.setRecordingEnabled(
+ !this.state.isRecordingEnabled
+ );
+ }}
+ isRecordingEnabled={this.state.isRecordingEnabled}
+ />