-
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
Merged
+1,148
−163
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
d738651
SOF-7354: show labels with atomic symbols when present
pranabdas 911c30d
SOF-7354: chore ==> remove unused import and lint fix
pranabdas 64533a3
SOF-7354: chore ==> bump github workflow actions
pranabdas 217fbae
SOF-7354: update atomName in tests
pranabdas 00792e8
SOF-7354: bump esse and made
pranabdas 00311f4
SOF-7354: update macos screenshot asset
pranabdas a507f56
SOF-7354: remove duplicate centos screenshots
pranabdas 7eaaadd
SOF-7354: set slightly different color for atoms with labels
pranabdas d165223
SOF-7354: add missing screenshot for ubuntu snapshot test
pranabdas 481cb88
SOF-7354: add snapshot test for colors of atoms with labels
pranabdas 7080394
SOF-7354: chore ==> fix linter error
pranabdas a9229f6
SOF-7354: fix screenshot filename
pranabdas f99fc5e
SOF-7354: remove obsolete docker-compose version line
pranabdas fe6be12
SOF-7354: chore ==> reference for THREE.Color.lerp
pranabdas 54c61e5
SOF-7354: update visually similar snapshots for ubuntu
pranabdas 519fa0b
SOF-7354: set glow to atoms with labels instead of changing colors
pranabdas d1e0b62
SOF-7354: set lower glow intensity
pranabdas 75e04b6
SOF-7354: try different glow intensity
pranabdas 9231964
SOF-7354: try different saturation and intensity
pranabdas f6caf64
SOF-7354: more experiment with colors
pranabdas 144e039
SOF-7354: more experiment with colors x2
pranabdas 173af7c
SOF-7354: more experiment with colors x3
pranabdas 46672f5
SOF-7354: more experiment with colors x4
pranabdas 1d15176
SOF-7354: fix object cloning by storing additional data in userData
pranabdas 9e33e3e
SOF-7354: store apply glow logic in separate function in utils
pranabdas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
3 changes: 3 additions & 0 deletions
3
tests/__tests__/__snapshots__/centos/colorsOfAtomsWithLabels.expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
3 changes: 3 additions & 0 deletions
3
tests/__tests__/__snapshots__/macos/colorsOfAtomsWithLabels.expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions
4
tests/__tests__/__snapshots__/macos/preserveThreeJsEditorChanges.expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
tests/__tests__/__snapshots__/ubuntu/colorsOfAtomsWithLabels.expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
tests/__tests__/__snapshots__/ubuntu/preserveThreeJsEditorChanges.expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Git LFS file not shown
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.