diff --git a/src/mixins/atoms.js b/src/mixins/atoms.js index 3254725..11880a5 100644 --- a/src/mixins/atoms.js +++ b/src/mixins/atoms.js @@ -88,6 +88,7 @@ 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({ @@ -95,6 +96,7 @@ export const AtomsMixin = (superclass) => coordinate: atomicCoordinate.value, }); sphereMesh.name = `${element}-${atomicIndex}`; + sphereMesh.nameWithLabel = `${elementsWithLabelsArray[atomicIndex]}`; atomsGroup.add(sphereMesh); }); return atomsGroup; diff --git a/src/mixins/labels.js b/src/mixins/labels.js index 10f9495..3011690 100644 --- a/src/mixins/labels.js +++ b/src/mixins/labels.js @@ -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, );