Skip to content

Commit

Permalink
Merge branch 'develop' into feature/CELE-107
Browse files Browse the repository at this point in the history
  • Loading branch information
aranega authored Nov 1, 2024
2 parents 62afe21 + ccebfc1 commit a0629c4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ const STLViewer: FC<Props> = ({ instances, isWireframe }) => {
<group frustumCulled={false}>
{stlObjects.map((stl, idx) => (
<STLMesh
key={instances[idx].id}
id={instances[idx].id}
key={instances[idx]?.id}
id={instances[idx]?.id}
stl={stl}
opacity={instances[idx].opacity}
color={instances[idx].color}
opacity={instances[idx]?.opacity}
color={instances[idx]?.color}
renderOrder={idx}
isWireframe={isWireframe}
/>
Expand Down
8 changes: 7 additions & 1 deletion applications/visualizer/frontend/src/models/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ export interface EMViewerData {
color: string;
}

function getRandomColor(): string {
return `#${Math.floor(Math.random() * 16777215)
.toString(16)
.padStart(6, "0")}`;
}

export function getDefaultViewerData(visibility?: Visibility): ViewerData {
return {
[ViewerType.Graph]: {
Expand All @@ -49,7 +55,7 @@ export function getDefaultViewerData(visibility?: Visibility): ViewerData {
},
[ViewerType.ThreeD]: {
visibility: visibility ?? Visibility.Hidden,
color: "#000000",
color: getRandomColor(),
},
[ViewerType.EM]: {
visibility: visibility ?? Visibility.Hidden,
Expand Down

0 comments on commit a0629c4

Please sign in to comment.