diff --git a/js/cells/supercells/CompositeCell.js b/js/cells/supercells/CompositeCell.js new file mode 100644 index 0000000000000000000000000000000000000000..ab6d23afd311517cf36dd4a1fc8eb718c2878158 --- /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 0ea2d588f2bcac2262139c676a080e6e87c7a35c..08dcadd9342e3b55678c97e9cb11235e53a484d0 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 9764504ee150cc778cbf6b64fb072dbf6b0d3492..6a70086c4026a3e2fbc38da69131124778f80a5d 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"),