Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions dist/components/ThreeDEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ export class ThreeDEditor extends React.Component {
const isDrawBondsEnabled = this._getWaveProperty("isDrawBondsEnabled") || false;
return (_jsx(WaveComponent, { ref: (el) => {
this.WaveComponent = el;
}, triggerHandleResize: viewerTriggerResize, isConventionalCellShown: isConventionalCellShown, isDrawBondsEnabled: isDrawBondsEnabled, isViewAdjustable: viewerSettings.isViewAdjustable, structure: materialCopy, boundaryConditions: boundaryConditions, cell: materialCopy.Lattice.unitCell, name: materialCopy.name, settings: viewerSettings }));
}, triggerHandleResize: viewerTriggerResize, isConventionalCellShown: isConventionalCellShown, isDrawBondsEnabled: isDrawBondsEnabled, isViewAdjustable: viewerSettings.isViewAdjustable, structure: materialCopy, boundaryConditions: boundaryConditions, cell: materialCopy.getLattice().unitCell, name: materialCopy.name, settings: viewerSettings }));
}
// TODO: move in the toolbar component when it's created
// eslint-disable-next-line class-methods-use-this
Expand Down Expand Up @@ -613,10 +613,10 @@ export class ThreeDEditor extends React.Component {
const { originalMaterial } = this.state;
const { onUpdate } = this.props;
// preserve lattice type
material.lattice = {
...material.Lattice.toJSON(),
type: originalMaterial.Lattice.type,
};
material.setLattice({
...material.getLattice().toJSON(),
type: originalMaterial.getLattice().type,
});
this.setState({
originalMaterial: material,
material: material.clone(),
Expand Down
5 changes: 3 additions & 2 deletions dist/mixins/atoms.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Basis, MaterialInMemoryEntity } from "@mat3ra/made";
import type { InMemoryEntity } from "@mat3ra/code/dist/js/entity";
import { Basis, Material } from "@mat3ra/made";
import * as THREE from "three";
import { Object3D } from "three";
export declare const AtomsMixin: (superclass: any) => {
new (config: any): {
[x: string]: any;
readonly structure: any;
setStructure(material: MaterialInMemoryEntity): void;
setStructure(material: Material & InMemoryEntity): void;
readonly basis: any;
initSphereParameters(): void;
/**
Expand Down
2 changes: 1 addition & 1 deletion dist/mixins/atoms.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const AtomsMixin = (superclass) => class extends superclass {
}
setStructure(material) {
this._structure = material.clone(); // clone original structure to assert that any updates are propagated to parents
this._basis = material.Basis;
this._basis = material.getBasis();
this._basis.originalUnits = this._basis.units;
this._basis.toCartesian();
this.verticesHashMap = this.createAtomVerticesHashMap();
Expand Down
6 changes: 3 additions & 3 deletions dist/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export function ThreeDSceneDataToMaterial(scene) {
export function materialsToThreeDSceneData(materials, shift = [2, 0, 0]) {
const wave = new Wave({
structure: materials[0],
cell: materials[0].Lattice.unitCell,
cell: materials[0].getLattice().unitCell,
DOMElement: document.createElement("div"),
});
if (materials.length > 1) {
Expand All @@ -83,9 +83,9 @@ export function materialsToThreeDSceneData(materials, shift = [2, 0, 0]) {
material.toCartesian();
const structureGroup = new THREE.Group();
structureGroup.name = material.name || material.formula;
const atomsGroup = wave.createAtomsGroup(material.Basis);
const atomsGroup = wave.createAtomsGroup(material.getBasis());
structureGroup.add(atomsGroup);
const unitCellObject = wave.getUnitCellObject(material.Lattice.unitCell);
const unitCellObject = wave.getUnitCellObject(material.getLattice().unitCell);
unitCellObject.visible = false;
structureGroup.add(unitCellObject);
structureGroup.position.set(...shift); // slightly shift along x axis
Expand Down
112 changes: 11 additions & 101 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@
"devDependencies": {
"@exabyte-io/cove.js": "2025.2.22-0",
"@exabyte-io/eslint-config": "^2025.1.15-0",
"@mat3ra/code": "2025.4.27-0",
"@mat3ra/code": "https://github.com/Exabyte-io/code/archive/62fa688445923bcb412b362e8a41b365bdbbad29.tar.gz",
"@mat3ra/esse": "2025.4.22-0",
"@mat3ra/made": "2025.6.25-1",
"@mat3ra/made": "https://github.com/Exabyte-io/made/archive/bd4309ae3ea20cb5026658b6c0a8ab7b965ab076.tar.gz",
"@mat3ra/tsconfig": "^2024.6.3-0",
"@mat3ra/utils": "2026.5.28-4",
"@types/react": "^18.2.8",
Expand Down
10 changes: 5 additions & 5 deletions src/components/ThreeDEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ export class ThreeDEditor extends React.Component {
isViewAdjustable={viewerSettings.isViewAdjustable}
structure={materialCopy}
boundaryConditions={boundaryConditions}
cell={materialCopy.Lattice.unitCell}
cell={materialCopy.getLattice().unitCell}
name={materialCopy.name}
settings={viewerSettings}
/>
Expand Down Expand Up @@ -733,10 +733,10 @@ export class ThreeDEditor extends React.Component {
const { originalMaterial } = this.state;
const { onUpdate } = this.props;
// preserve lattice type
material.lattice = {
...material.Lattice.toJSON(),
type: originalMaterial.Lattice.type,
};
material.setLattice({
...material.getLattice().toJSON(),
type: originalMaterial.getLattice().type,
});
this.setState({
originalMaterial: material,
material: material.clone(),
Expand Down
7 changes: 4 additions & 3 deletions src/mixins/atoms.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { InMemoryEntity } from "@mat3ra/code/dist/js/entity";
import { AtomicCoordinateSchema } from "@mat3ra/esse/dist/js/types";
import { Basis, MaterialInMemoryEntity } from "@mat3ra/made";
import { Basis, Material } from "@mat3ra/made";
import * as THREE from "three";
import { Object3D } from "three";

Expand Down Expand Up @@ -29,9 +30,9 @@ export const AtomsMixin = (superclass: any) =>
return this._structure;
}

setStructure(material: MaterialInMemoryEntity) {
setStructure(material: Material & InMemoryEntity) {
this._structure = material.clone(); // clone original structure to assert that any updates are propagated to parents
this._basis = material.Basis;
this._basis = material.getBasis();
this._basis.originalUnits = this._basis.units;
this._basis.toCartesian();
this.verticesHashMap = this.createAtomVerticesHashMap();
Expand Down
6 changes: 3 additions & 3 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export function ThreeDSceneDataToMaterial(scene) {
export function materialsToThreeDSceneData(materials, shift = [2, 0, 0]) {
const wave = new Wave({
structure: materials[0],
cell: materials[0].Lattice.unitCell,
cell: materials[0].getLattice().unitCell,
DOMElement: document.createElement("div"),
});
if (materials.length > 1) {
Expand All @@ -93,9 +93,9 @@ export function materialsToThreeDSceneData(materials, shift = [2, 0, 0]) {
material.toCartesian();
const structureGroup = new THREE.Group();
structureGroup.name = material.name || material.formula;
const atomsGroup = wave.createAtomsGroup(material.Basis);
const atomsGroup = wave.createAtomsGroup(material.getBasis());
structureGroup.add(atomsGroup);
const unitCellObject = wave.getUnitCellObject(material.Lattice.unitCell);
const unitCellObject = wave.getUnitCellObject(material.getLattice().unitCell);
unitCellObject.visible = false;
structureGroup.add(unitCellObject);
structureGroup.position.set(...shift); // slightly shift along x axis
Expand Down
2 changes: 1 addition & 1 deletion tests/__tests__/mixins/boundary.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class BoundaryMixinTestBase {
constructor(config) {
this.boundaryConditions = config.boundaryConditions || {};
const material = new Made.Material(MATERIAL_CONFIG);
this.basis = material.Basis;
this.basis = material.getBasis();
}
}

Expand Down
4 changes: 2 additions & 2 deletions tests/enums.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function getWaveInstance(settings, material = new Made.Material(MATERIAL_
return new Wave({
DOMElement: createElement("div", ELEMENT_PROPERTIES),
structure: material,
cell: material.Lattice.unitCell,
cell: material.getLattice().unitCell,
settings: settings || WAVE_SETTINGS,
});
}
Expand All @@ -41,7 +41,7 @@ export function getFeOWaveInstance(settings, material = new Made.Material(FeO_CO
return new Wave({
DOMElement: createElement("div", ELEMENT_PROPERTIES),
structure: material,
cell: material.Lattice.unitCell,
cell: material.getLattice().unitCell,
settings: settings || WAVE_SETTINGS,
});
}
4 changes: 2 additions & 2 deletions tests/fixtures/FeO.json
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/fixtures/material.json
Git LFS file not shown
Loading