Skip to content

Commit

Permalink
SOF-7354: show labels with atomic symbols when present
Browse files Browse the repository at this point in the history
  • Loading branch information
pranabdas committed May 6, 2024
1 parent fac1ab5 commit d738651
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/mixins/atoms.js
Expand Up @@ -88,13 +88,15 @@ export const AtomsMixin = (superclass) =>
createAtomsGroup(basis, atomRadiiScale) {
const atomsGroup = new THREE.Group();
atomsGroup.name = ATOM_GROUP_NAME;
const { elementsWithLabelsArray } = basis;
basis.coordinates.forEach((atomicCoordinate, atomicIndex) => {
const element = basis.getElementByIndex(atomicIndex);
const sphereMesh = this.getSphereMeshObject({
...this._getDefaultSettingsForElement(element, atomRadiiScale),
coordinate: atomicCoordinate.value,
});
sphereMesh.name = `${element}-${atomicIndex}`;
sphereMesh.nameWithLabel = `${elementsWithLabelsArray[atomicIndex]}`;
atomsGroup.add(sphereMesh);
});
return atomsGroup;
Expand Down
2 changes: 1 addition & 1 deletion src/mixins/labels.js
Expand Up @@ -111,7 +111,7 @@ export const LabelsMixin = (superclass) =>

group.children.forEach((atom) => {
if (atom instanceof THREE.Mesh) {
const text = atom.name.split("-")[0];
const text = atom.nameWithLabel;
const position = new THREE.Vector3().setFromMatrixPosition(
atom.matrixWorld,
);
Expand Down

0 comments on commit d738651

Please sign in to comment.