From b98e08e33d65ca0ce8090bbfc28c8a74a41303f5 Mon Sep 17 00:00:00 2001
From: Amanda Ghassaei <amandaghassaei@gmail.com>
Date: Fri, 12 Jun 2015 11:41:04 -0700
Subject: [PATCH] fixes

---
 js/cells/supercells/CompositeCell.js | 33 ++++++++++++++++++++++++++++
 js/lattice/Lattice.js                |  3 ++-
 js/menus/CompositeMenu.js            |  3 ++-
 3 files changed, 37 insertions(+), 2 deletions(-)
 create mode 100644 js/cells/supercells/CompositeCell.js

diff --git a/js/cells/supercells/CompositeCell.js b/js/cells/supercells/CompositeCell.js
new file mode 100644
index 00000000..ab6d23af
--- /dev/null
+++ b/js/cells/supercells/CompositeCell.js
@@ -0,0 +1,33 @@
+/**
+ * Created by aghassaei on 6/12/15.
+ */
+
+
+define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'superCell', 'gikCell'],
+    function(_, THREE, three, lattice, appState, DMASuperCell, GIKCell){
+
+    CompositeCell = function(json, superCell){
+        DMASuperCell.call(this, json, superCell);
+    };
+    CompositeCell.prototype = Object.create(DMASuperCell.prototype);
+
+    CompositeCell.prototype._makeSubCellForIndex = function(json){
+        return null;
+    };
+
+
+
+    CompositeCell.prototype._getGeometry = function(){
+        return new THREE.BoxGeometry();
+    };
+
+    CompositeCell.prototype._buildWireframe = function(mesh){
+        var wireframe = new THREE.BoxHelper(mesh);
+        wireframe.material.color.set(0x000000);
+        wireframe.matrixWorld = mesh.matrixWorld;
+        wireframe.matrixAutoUpdate = true;
+        return wireframe;
+    };
+
+    return CompositeCell;
+});
\ No newline at end of file
diff --git a/js/lattice/Lattice.js b/js/lattice/Lattice.js
index 0ea2d588..08dcadd9 100644
--- a/js/lattice/Lattice.js
+++ b/js/lattice/Lattice.js
@@ -249,7 +249,8 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
         },
 
         inCompositeMode: function(){
-            return appState.get("currentNav") == "navComposite" && this.compositeEditor;
+            if (this.compositeEditor) return true;
+            return false;
         },
 
         _isSingltonLattice: function(){
diff --git a/js/menus/CompositeMenu.js b/js/menus/CompositeMenu.js
index 9764504e..6a70086c 100644
--- a/js/menus/CompositeMenu.js
+++ b/js/menus/CompositeMenu.js
@@ -21,6 +21,7 @@ define(['jquery', 'underscore', 'menuParent', 'plist', 'lattice', 'globals'], fu
                 return;
             }
             this.listenTo(lattice.compositeEditor, "change", this.render);
+            this.listenTo(lattice, "change", this.render);
         },
 
         _changeRandomColor: function(e){
@@ -70,7 +71,7 @@ define(['jquery', 'underscore', 'menuParent', 'plist', 'lattice', 'globals'], fu
         },
 
         _makeTemplateJSON: function(){
-            return _.extend(plist, this.model.toJSON(), globals, lattice.compositeEditor.toJSON(),
+            return _.extend(this.model.toJSON(), plist, globals, lattice.compositeEditor.toJSON(),
                 {
                     materialClass:lattice.get("materialClass"),
                     materialType:lattice.get("materialType"),
-- 
GitLab