Skip to content

Commit

Permalink
fix typing
Browse files Browse the repository at this point in the history
  • Loading branch information
meganrm committed Nov 9, 2023
1 parent cc272ad commit 21e56cc
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions src/viewport/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { TrajectoryFileInfoAny } from "../simularium/types";
import { updateTrajectoryFileInfoFormat } from "../simularium/versionHandlers";
import { FrontEndError, ErrorLevel } from "../simularium/FrontEndError";
import { RenderStyle, VisGeometry, NO_AGENT } from "../visGeometry";
import { ColorChanges } from "../simularium/SelectionInterface";
import { ColorChanges, SelectionEntry } from "../simularium/SelectionInterface";

export type PropColor = string | number | [number, number, number];

Expand Down Expand Up @@ -56,7 +56,7 @@ const defaultProps = {
selectionStateInfo: {
colorChanges: [
{
agents: [],
agents: [] as SelectionEntry[],
color: "",
},
],
Expand Down Expand Up @@ -329,7 +329,11 @@ class Viewport extends React.Component<
!isEqual(
selectionStateInfo.colorChanges,
prevProps.selectionStateInfo.colorChanges
) && !isEqual(selectionStateInfo.colorChanges, defaultProps.selectionStateInfo.colorChanges)
) &&
!isEqual(
selectionStateInfo.colorChanges,
defaultProps.selectionStateInfo.colorChanges
)
) {
this.changeAgentsColor(selectionStateInfo.colorChanges);
}
Expand Down Expand Up @@ -569,18 +573,21 @@ class Viewport extends React.Component<
}

public changeAgentsColor(colorChanges: ColorChanges[]): void {
const {
onUIDisplayDataChanged,
} = this.props;
const { onUIDisplayDataChanged } = this.props;
colorChanges.forEach((colorChange) => {
const { agents, color } = colorChange;
const uiDisplayData = this.selectionInterface.getUIDisplayData();
const agentIds =
this.selectionInterface.getAgentIdsByNamesAndTags(agents);
this.selectionInterface.updateAgentColors(agentIds, colorChange, uiDisplayData);
this.selectionInterface.updateAgentColors(
agentIds,
colorChange,
uiDisplayData
);
const colorId = this.getColorId(color);
this.visGeometry.applyColorToAgents(agentIds, colorId);
const updatedUiDisplayData = this.selectionInterface.getUIDisplayData();
const updatedUiDisplayData =
this.selectionInterface.getUIDisplayData();
onUIDisplayDataChanged(updatedUiDisplayData);
});
}
Expand Down

0 comments on commit 21e56cc

Please sign in to comment.