From 90569c25ac4c26b60bb619050ba20cdd96e20f0b Mon Sep 17 00:00:00 2001 From: Amanda Ghassaei <amandaghassaei@gmail.com> Date: Wed, 24 Jun 2015 14:16:08 -0700 Subject: [PATCH] bug fixes --- js/cells/supercells/CompositeCell.js | 4 ++-- js/cells/supercells/DMASuperCell.js | 5 +++-- js/lattice/LatticeBase.js | 2 +- js/materials/DMAMaterials.js | 1 + 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/js/cells/supercells/CompositeCell.js b/js/cells/supercells/CompositeCell.js index 49a0021a..70976006 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 a5641e8f..6fe753f4 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 5bf3fb9f..adff6d49 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 5314cc34..b403afa0 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(); -- GitLab