From bcb7c5f9bec2a4af57f75c95aeb8648771917be3 Mon Sep 17 00:00:00 2001
From: Amanda Ghassaei <amandaghassaei@gmail.com>
Date: Wed, 28 Jan 2015 16:13:07 -0500
Subject: [PATCH] able to add cells in part mode

---
 js/fea/dmaCell.js | 9 ++++-----
 js/fea/dmaPart.js | 2 +-
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/js/fea/dmaCell.js b/js/fea/dmaCell.js
index 10efcfc8..75a12508 100644
--- a/js/fea/dmaCell.js
+++ b/js/fea/dmaCell.js
@@ -39,6 +39,9 @@
         this.indices = indices;
         this.position = this._calcPositionForScale(scale);
 
+        this.cellMesh = this._buildCellMesh(this.position);
+        window.three.sceneAdd(this.cellMesh);
+
         this.parts = this._initParts(this.position);
         this.drawForMode(mode);
     }
@@ -84,11 +87,7 @@
     DMACell.prototype.drawForMode = function(mode){
         console.log(mode);
         if (mode == "cell"){
-            if (this.cellMesh) this._setCellMeshVisibility(true);
-            else {
-                this.cellMesh = this._buildCellMesh(this.position);
-                window.three.sceneAdd(this.cellMesh);
-            }
+            this._setCellMeshVisibility(true);
             _.each(this.parts, function(part){
                 part.hide();
             });
diff --git a/js/fea/dmaPart.js b/js/fea/dmaPart.js
index 33f00284..187ee0b9 100644
--- a/js/fea/dmaPart.js
+++ b/js/fea/dmaPart.js
@@ -35,7 +35,7 @@
 
     DMAPart.prototype._draw = function(){
         this.mesh = this._makeMeshForType(this.type);
-        window.three.sceneAdd(this.mesh);
+        window.three.sceneAdd(this.mesh, false);
     };
 
     DMAPart.prototype._makeMeshForType = function(type){
-- 
GitLab