Skip to content

Commit

Permalink
add type for colorinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
meganrm committed Dec 4, 2023
1 parent 99fd604 commit f465e52
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/visGeometry/ColorHandler.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { map, round, isEqual } from "lodash";
import { Color } from "three";
import { AgentColorInfo } from "./types";

export function convertColorStringToNumber(color: number | string): number {
if (typeof color !== "string") {
Expand Down Expand Up @@ -195,10 +196,7 @@ class ColorHandler {
return this.getColorById(index);
}

public getColorInfoForAgentType(agentType: number): {
color: Color;
colorId: number;
} {
public getColorInfoForAgentType(agentType: number): AgentColorInfo {
const color = this.getColorForAgentType(agentType);
const colorId = this.getColorIdForAgentType(agentType);
return { color, colorId };
Expand Down
7 changes: 6 additions & 1 deletion src/visGeometry/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BufferGeometry, Object3D } from "three";
import { BufferGeometry, Color, Object3D } from "three";
import PDBModel from "./PDBModel";
import { MRTShaders } from "./rendering/MultipassMaterials";

Expand Down Expand Up @@ -64,3 +64,8 @@ export interface GeometryStoreLoadResponse {
geometry: MeshLoadRequest | PDBModel;
errorMessage?: string;
}

export interface AgentColorInfo {
color: Color;
colorId: number;
}

0 comments on commit f465e52

Please sign in to comment.