diff --git a/js/fea/DmaCell.js b/js/fea/DmaCell.js index 622d264c9f9353ec2b3292237ea819718aa7d14a..6b532fb7507ddfbf843e354d8852286f9b5595d1 100644 --- a/js/fea/DmaCell.js +++ b/js/fea/DmaCell.js @@ -69,7 +69,9 @@ DMACell.prototype.getIndex = function(){ DMACell.prototype.destroy = function(){ if (this.cellMesh) { - dmaGlobals.three.sceneRemove(this.cellMesh, "cell"); + var type = "cell"; + if (this.isInverse) type = "inverseCell" + dmaGlobals.three.sceneRemove(this.cellMesh, type); this.cellMesh.myParent = null; // this.cellMesh.dispose(); // geometry.dispose(); diff --git a/js/models/Lattice.js b/js/models/Lattice.js index febe16ab4b4444dd2dee7b773d265c5ffb489647..efbe50271f8c9e31ce31a1c0e0d67b2f5d5fe955 100644 --- a/js/models/Lattice.js +++ b/js/models/Lattice.js @@ -143,6 +143,7 @@ Lattice = Backbone.Model.extend({ this.set("inverseCells", [[[null]]]); this.set("inverseCellsMin", {x:0, y:0, z:0}); this.set("inverseCellsMax", {x:0, y:0, z:0}); + this.set("numInvCells", 0); }, //////////////////////////////////////////////////////////////////////////////////// @@ -556,8 +557,7 @@ Lattice = Backbone.Model.extend({ self._checkForMatrixExpansion(invCells, invIndex, invIndex, "inverseCellsMax", "inverseCellsMin"); var indexRel = self._subtract(invIndex, self.get("inverseCellsMin")); if (!invCells[indexRel.x][indexRel.y][indexRel.z]) { - var cell = self._makeInvCellForLatticeType(invIndex, scale); - invCells[indexRel.x][indexRel.y][indexRel.z] = cell; + invCells[indexRel.x][indexRel.y][indexRel.z] = self._makeInvCellForLatticeType(invIndex, scale); self.set("numInvCells", self.get("numInvCells")+1); } }); diff --git a/js/models/ThreeModel.js b/js/models/ThreeModel.js index 39768f44fac7ba222db5a3dae0cdde1bb9d7e281..2c47785a73e47fc2766f8176b1bbbbad140f82a3 100644 --- a/js/models/ThreeModel.js +++ b/js/models/ThreeModel.js @@ -56,7 +56,7 @@ function ThreeModel(){ if (type == "cell"){ cells.push(object.children[0]); } else if (type == "inverseCell"){ - invCells.push(object); + invCells.push(object.children[0]); } else if (type == "part"){ parts.push(object); } else if (type == "basePlane"){ @@ -71,7 +71,7 @@ function ThreeModel(){ if (type == "cell"){ cells.splice(cells.indexOf(objectToRemove.children[0]), 1); } else if (type == "inverseCell"){ - invCells.splice(invCells.indexOf(objectToRemove), 1); + invCells.splice(invCells.indexOf(objectToRemove.children[0]), 1); } else if (type == "part"){ parts.splice(parts.indexOf(objectToRemove), 1); } else if (type == "basePlane"){