From f465e52d54e7c5837c2e22cb1a7463352b77ff49 Mon Sep 17 00:00:00 2001 From: meganrm Date: Mon, 4 Dec 2023 14:27:29 -0800 Subject: [PATCH] add type for colorinfo --- src/visGeometry/ColorHandler.ts | 6 ++---- src/visGeometry/types.ts | 7 ++++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/visGeometry/ColorHandler.ts b/src/visGeometry/ColorHandler.ts index 003ba209..fd221742 100644 --- a/src/visGeometry/ColorHandler.ts +++ b/src/visGeometry/ColorHandler.ts @@ -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") { @@ -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 }; diff --git a/src/visGeometry/types.ts b/src/visGeometry/types.ts index abca5d4e..85e998f7 100644 --- a/src/visGeometry/types.ts +++ b/src/visGeometry/types.ts @@ -1,4 +1,4 @@ -import { BufferGeometry, Object3D } from "three"; +import { BufferGeometry, Color, Object3D } from "three"; import PDBModel from "./PDBModel"; import { MRTShaders } from "./rendering/MultipassMaterials"; @@ -64,3 +64,8 @@ export interface GeometryStoreLoadResponse { geometry: MeshLoadRequest | PDBModel; errorMessage?: string; } + +export interface AgentColorInfo { + color: Color; + colorId: number; +}