-
Couldn't load subscription status.
- Fork 3
SOF-7354: show labels with atomic symbols when present #152
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
Changes from all commits
d738651
911c30d
64533a3
217fbae
00792e8
00311f4
a507f56
7eaaadd
d165223
481cb88
7080394
a9229f6
f99fc5e
fe6be12
54c61e5
519fa0b
d1e0b62
75e04b6
9231964
f6caf64
144e039
173af7c
46672f5
1d15176
9e33e3e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,3 @@ | ||
| version: "3.8" | ||
|
|
||
| services: | ||
| wave: | ||
| image: wave-${BASE_OS}:${IMAGE_TAG} | ||
|
|
||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| import * as THREE from "three"; | ||
|
|
||
| import { ATOM_GROUP_NAME } from "../enums"; | ||
| import { ApplyGlow } from "./utils"; | ||
|
|
||
| /* | ||
| * Mixin containing the logic for dealing with atoms. | ||
|
|
@@ -88,13 +89,27 @@ export const AtomsMixin = (superclass) => | |
| createAtomsGroup(basis, atomRadiiScale) { | ||
| const atomsGroup = new THREE.Group(); | ||
| atomsGroup.name = ATOM_GROUP_NAME; | ||
| const { atomicLabelsArray, 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}`; | ||
| // store any additional data in userData | ||
| // https://threejs.org/docs/#api/en/core/Object3D.userData | ||
| sphereMesh.userData = { | ||
| ...sphereMesh.userData, | ||
| symbolWithLabel: elementsWithLabelsArray[atomicIndex], | ||
| }; | ||
| const atomColor = this.getAtomColorByElement(element).toLowerCase(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| const label = parseInt(atomicLabelsArray[atomicIndex], 10) || 0; | ||
| // set glow according to the label value as offset, 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 | ||
| ApplyGlow(sphereMesh, atomColor, label); | ||
| atomsGroup.add(sphereMesh); | ||
| }); | ||
| return atomsGroup; | ||
|
|
||
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
userDataconcept or was it used before?Maybe
metadatawould be a better name - is there really data that comes from user here??Uh oh!
There was an error while loading. Please reload this page.
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.