diff --git a/js/cells/supercells/CompositeCell.js b/js/cells/supercells/CompositeCell.js index 49a0021a61c477682da9919a4190d8d1e09e42dc..70976006c1700ed75d690969cf06dfd0aaf2cc92 100644 --- a/js/cells/supercells/CompositeCell.js +++ b/js/cells/supercells/CompositeCell.js @@ -6,9 +6,9 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'superCell', 'globals', 'materials'], function(_, THREE, three, lattice, appState, DMASuperCell, globals, materials){ - CompositeCell = function(json, superCell){ + function CompositeCell(json, superCell){ DMASuperCell.call(this, json, superCell); - }; + } CompositeCell.prototype = Object.create(DMASuperCell.prototype); CompositeCell.prototype._getGeometry = function(){ diff --git a/js/cells/supercells/DMASuperCell.js b/js/cells/supercells/DMASuperCell.js index a5641e8f2a56b7faf670edda72fe58984d721f02..6fe753f4078166f747a949257de2d774ccaf262e 100644 --- a/js/cells/supercells/DMASuperCell.js +++ b/js/cells/supercells/DMASuperCell.js @@ -25,7 +25,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cell'], } DMASuperCell.prototype = Object.create(DMACell.prototype); - DMASuperCell.prototype._getSuperCellRange = function(){ + DMASuperCell.prototype._getSuperCellRange = function(){//override in gik super cell return appState.get("superCellRange").clone(); }; @@ -43,7 +43,8 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cell'], if (material.sparseCells){ if (material.sparseCells[x][y][z]){ this._makeSubCellForIndex({index: new THREE.Vector3(x,y,z), materialName:material.sparseCells[x][y][z].materialName}, function(cell){ - cells[x][y][z] = cell; + var cellIndex = cell.getIndex();//x,y,z have changed by now + cells[cellIndex.x][cellIndex.y][cellIndex.z] = cell; }); }//else no cell in this spot } else {//if not from composite definition, add subcell at all possible indices in supercell range diff --git a/js/lattice/LatticeBase.js b/js/lattice/LatticeBase.js index 5bf3fb9f4c05e8dcc664b82247c71d7eb07b82e2..adff6d49b3d4ad618732154b98198850635e0ca9 100644 --- a/js/lattice/LatticeBase.js +++ b/js/lattice/LatticeBase.js @@ -133,7 +133,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre var relIndex = (new THREE.Vector3()).subVectors(index, this.get("cellsMin") || index); if (!noRender || noRender === undefined) three.setRenderFlag(); - this.addCellWithJson({index: index}, relIndex); + this.addCellWithJson({index: index, materialName:appState.get("materialType")}, relIndex); }, addCellWithJson: function(json, index){ diff --git a/js/materials/DMAMaterials.js b/js/materials/DMAMaterials.js index 5314cc344d6adc0c635b0b25c17830b89e3262dc..b403afa063fd054734af8e78e11a0f20ecf91ab1 100644 --- a/js/materials/DMAMaterials.js +++ b/js/materials/DMAMaterials.js @@ -57,6 +57,7 @@ define(['underscore', 'three', 'appState', 'lattice', 'plist', 'threeModel'], fu function changeColorScheme(){ var state = appState.get("realisticColorScheme"); _.each(_.keys(materials), function(name){ + if (name == "setMaterial") return; changeSingleMaterialColorScheme(name, state); }); three.render();