diff --git a/js/cells/DMACell.js b/js/cells/DMACell.js index d020a0a68c0589f1b0c8319eeaba2e7da4ff073b..8a7f399b10ae53da749cdea0c28f091ebde1a6de 100644 --- a/js/cells/DMACell.js +++ b/js/cells/DMACell.js @@ -245,7 +245,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals', ' switch(mode) { case "supercell": - if (!this.superCell && !this.cells) mode = "cell";//top level item + if (this._isTopLayerCell()) mode = "cell";//top level item setVisiblity(); break; case "cell": @@ -278,7 +278,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals', ' function setVisiblity(){ var visible = true; - if (mode == "supercell") visible = !(self.superCell && self.cells);//middle layers are always hidden in supercell mode + if (mode == "supercell") visible = !self._isMiddleLayer();//middle layers are always hidden in supercell mode _.each(self.object3D.children, function(child){ if (child.name == "object3D") return; @@ -293,6 +293,15 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals', ' } }; + DMACell.prototype._isMiddleLayer = function(){ + return false; + }; + + DMACell.prototype._isTopLayerCell = function(){ + return this.superCell === null || this.superCell === undefined; + }; + + diff --git a/js/cells/supercells/DMASuperCell.js b/js/cells/supercells/DMASuperCell.js index c44d1293eb0882f908fd48d9e5c6f0eabd2562ab..37d16d71a45f53c3c0057282ffd58ab36779a7d2 100644 --- a/js/cells/supercells/DMASuperCell.js +++ b/js/cells/supercells/DMASuperCell.js @@ -95,6 +95,14 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cell'], }; + DMASuperCell.prototype._isMiddleLayer = function(){ + return this.superCell !== null && this.superCell !== undefined; + }; + + DMASuperCell.prototype._isTopLayerCell = function(){ + return false; + }; + diff --git a/js/cells/supercells/GIKSuperCell.js b/js/cells/supercells/GIKSuperCell.js index 00022aaa13d26d350aecc417b4dfa0fa999db759..27832141d87a0aceea02ac45d89a9faf73a087dc 100644 --- a/js/cells/supercells/GIKSuperCell.js +++ b/js/cells/supercells/GIKSuperCell.js @@ -61,6 +61,14 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'superCell', return "cell"; }; + GIKSuperCell.prototype._isMiddleLayer = function(){ + return false; + }; + + GIKSuperCell.prototype._isTopLayerCell = function(){ + return this.superCell === null || this.superCell === undefined; + }; + GIKSuperCell.prototype.toJSON = function(){ var data = DMASuperCell.prototype.toJSON.call(this); if (!this.length) console.warn("no length assigned to gik supercell"); diff --git a/js/lattice/latticeSubclasses/GIKLattice.js b/js/lattice/latticeSubclasses/GIKLattice.js index ec35be0fd563ee6861bb8f6b9cbef2d4579f1670..0b7250b0444e8c7bd9d0bf13cdff57bf49089689 100644 --- a/js/lattice/latticeSubclasses/GIKLattice.js +++ b/js/lattice/latticeSubclasses/GIKLattice.js @@ -14,6 +14,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre require([this.getHighlighterFile()], function(superCellHighlighter){ globals.highlighter = new superCellHighlighter(); }); + appState.set("superCellRange", new THREE.Vector3(appState.get("gikLength"), 1, 1)); }, getHighlighterFile: function(){ diff --git a/js/menus/CompositeMenuView.js b/js/menus/CompositeMenuView.js index 7f7867d3006c864d2dc511995fee8a35d332eead..d2f25ca32324e1e4ddddd3386002c4967f77b4ed 100644 --- a/js/menus/CompositeMenuView.js +++ b/js/menus/CompositeMenuView.js @@ -39,6 +39,11 @@ define(['jquery', 'underscore', 'menuParent', 'plist', 'lattice', 'globals', 'ma lattice.compositeEditor._changeRandomColor(); }, + getPropertyOwner: function($target){ + if ($target.hasClass("compositeEditor")) return lattice.compositeEditor; + return null; + }, + updateHex: function(hex){ //update hex without rendering $("#compositeColor").css("border-color", hex);