Skip to content
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

Merged
merged 25 commits into from May 23, 2024
Merged

Conversation

pranabdas
Copy link
Contributor

No description provided.

@@ -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;
Copy link
Member

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

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();
Copy link
Member

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,
Copy link
Member

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??

Copy link
Contributor Author

@pranabdas pranabdas May 20, 2024

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.

@pranabdas pranabdas merged commit b36d662 into dev May 23, 2024
2 checks passed
@pranabdas pranabdas deleted the feat/SOF-7354 branch May 23, 2024 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants