-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SOF-7354: show labels with atomic symbols when present #152
Conversation
src/mixins/labels.js
Outdated
@@ -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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's see if we can add a tests as well
+ add note on MESA glx error in Ubuntu 24.04
seems currently generated roate and repetitions snapshots are incorrect
otherwise, atomic labels become undefined when cell repetition is enabled
// set glow according to the labels, currently only single digit | ||
// numeric labels are allowed, in practice we expect only two | ||
// different labels: 1 and 2 for up and down spin representations | ||
const atomColor = this.getAtomColorByElement(element).toLowerCase(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's isolate the code that sets glow to a separate function and import from utils. Maybe even put to cove.js or another library
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.userData = { | ||
...sphereMesh.userData, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you just come up with this userData
concept or was it used before?
Maybe metadata
would be a better name - is there really data that comes from user here??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this is THREE.js in-build field to store custom data https://threejs.org/docs/#api/en/core/Object3D.userData. If we create our own data fields (e.g., metadata
), I think it will be stripped while cloning THREE objects.
No description provided.