From 72f25a450dde3246ae2c10c01c9e670e8a8afa2c Mon Sep 17 00:00:00 2001 From: Amanda Ghassaei <amandaghassaei@gmail.com> Date: Wed, 24 Jun 2015 16:39:15 -0700 Subject: [PATCH] bug fixes --- js/cells/supercells/CompositeCell.js | 2 +- js/cells/supercells/DMASuperCell.js | 4 ++-- js/lattice/LatticeBase.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/js/cells/supercells/CompositeCell.js b/js/cells/supercells/CompositeCell.js index f449d77e..622282f8 100644 --- a/js/cells/supercells/CompositeCell.js +++ b/js/cells/supercells/CompositeCell.js @@ -14,7 +14,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'superCell', CompositeCell.prototype._getGeometry = function(){ var dimensions = materials[this.materialName].dimensions; var geo = new THREE.BoxGeometry(dimensions.x*lattice.xScale(), dimensions.y*lattice.yScale(), dimensions.z*lattice.zScale()); - geo.applyMatrix(new THREE.Matrix4().makeTranslation(dimensions.x/2-0.5, dimensions.y/2-0.5, dimensions.z/2-0.5)); + geo.applyMatrix(new THREE.Matrix4().makeTranslation((dimensions.x/2-0.5)*lattice.xScale(), (dimensions.y/2-0.5)*lattice.yScale(), (dimensions.z/2-0.5)*lattice.zScale())); return geo; }; diff --git a/js/cells/supercells/DMASuperCell.js b/js/cells/supercells/DMASuperCell.js index 37d16d71..44bf5cee 100644 --- a/js/cells/supercells/DMASuperCell.js +++ b/js/cells/supercells/DMASuperCell.js @@ -40,9 +40,9 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cell'], cells[x][y].push(null); - var json = {index: new THREE.Vector3(x,y,z)}; + var json = {index: new THREE.Vector3(x, y, z)}; var callback = function(cell){ - var cellIndex = cell.getIndex();//x,y,z have changed by now + var cellIndex = cell.getIndex();//x, y, z have changed by now cells[cellIndex.x][cellIndex.y][cellIndex.z] = cell; }; diff --git a/js/lattice/LatticeBase.js b/js/lattice/LatticeBase.js index 06fdd267..15b3c4f0 100644 --- a/js/lattice/LatticeBase.js +++ b/js/lattice/LatticeBase.js @@ -204,7 +204,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre if (cell){ var material = cell.getMaterial(); if (material.dimensions){ - var subCellMax = (new THREE.Vector3(x, y, z)).add(material.dimensions); + var subCellMax = (new THREE.Vector3(x, y, z)).add(cell.applyAbsoluteRotation(material.dimensions)); dimVector.max(subCellMax); } else if (cell.length){ var subCellMax = (new THREE.Vector3(x, y, z)).add(cell.applyAbsoluteRotation(new THREE.Vector3(cell.length, 1, 1))); -- GitLab