From e493d3f96b13bf2d361d2ecef2ee2bca008cf6df Mon Sep 17 00:00:00 2001 From: Amanda Ghassaei <amandaghassaei@gmail.com> Date: Wed, 1 Jul 2015 10:13:09 -0700 Subject: [PATCH] fixes to conductor view --- js/cells/DMACell.js | 18 +++++++++++++----- js/lattice/CompositeEditorLattice.js | 5 ++++- js/lattice/LatticeEsim.js | 1 + js/menus/templates/Ribbon.html | 2 +- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/js/cells/DMACell.js b/js/cells/DMACell.js index 9412ea32..3121ecdf 100644 --- a/js/cells/DMACell.js +++ b/js/cells/DMACell.js @@ -245,8 +245,10 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals', ' this.object3D.children[0].material = material; }; - DMACell.prototype.setWireframeVisibility = function(visible){ - this.object3D.children[1].visible = visible; + DMACell.prototype.setWireframeVisibility = function(visible, mode){ + if (visible && mode === undefined) mode = this.getConditionalMode(appState.get("cellMode")); + console.log(visible && this.object3D.children[1].name == mode); + this.object3D.children[1].visible = visible && this.object3D.children[1].name == mode; }; DMACell.prototype.setTransparent = function(evalFunction){ @@ -257,14 +259,20 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals', ' this.setWireframeVisibility(!this.isTransparent); }; + DMACell.prototype.getConditionalMode = function(mode){ + if (mode == "supercell" && this._isTopLayerCell()) return "cell"; + return mode; + }; + DMACell.prototype.setMode = function(mode, callback){ if (!mode || mode === undefined) mode = appState.get("cellMode"); var self = this; + mode = this.getConditionalMode(mode); + switch(mode) { case "supercell": - if (this._isTopLayerCell()) mode = "cell";//top level item setVisiblity(); break; case "cell": @@ -299,12 +307,12 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals', ' var visible = true; if (mode == "supercell") visible = !self._isMiddleLayer();//middle layers are always hidden in supercell mode - self.setWireframeVisibility(!self.isTransparent); - _.each(self.object3D.children, function(child){ if (child.name == "object3D") return; child.visible = visible && (child.name == mode); }); + self.setWireframeVisibility(!self.isTransparent, mode); + if (callback) { callback(); return; diff --git a/js/lattice/CompositeEditorLattice.js b/js/lattice/CompositeEditorLattice.js index 83bd8f57..0fa5bf3d 100644 --- a/js/lattice/CompositeEditorLattice.js +++ b/js/lattice/CompositeEditorLattice.js @@ -102,7 +102,10 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre cellsMax: cellsMax, elementaryChildren: materials.getChildCellTypes(this.sparseCells, true), compositeChildren: materials.getChildCellTypes(this.sparseCells, false), - dimensions: _dimensions + dimensions: _dimensions, + properties: { + + } }; return data; }, diff --git a/js/lattice/LatticeEsim.js b/js/lattice/LatticeEsim.js index 08a6ebef..251b7c86 100644 --- a/js/lattice/LatticeEsim.js +++ b/js/lattice/LatticeEsim.js @@ -65,6 +65,7 @@ define(['lattice', 'appState', 'threeModel', 'eSim', 'eSimCell'], function(latti _.extend(lattice, eSimMethods); lattice.listenTo(appState, "change:currentTab", lattice._eSimTabChanged); lattice.listenTo(eSim, "change:visibleConductorGroup", lattice._showConductors); + lattice._showConductors(); return lattice; diff --git a/js/menus/templates/Ribbon.html b/js/menus/templates/Ribbon.html index 509d0625..179021b3 100644 --- a/js/menus/templates/Ribbon.html +++ b/js/menus/templates/Ribbon.html @@ -5,7 +5,7 @@ <% if (allPartTypes[cellType][connectionType]){ %> <a data-type="part" class="btn btn-primary btn-ribbon ribbonCellMode<% if (cellMode == "part"){ %> ribbon-selected<% } %>" href="#"><img data-type="part" src="assets/imgs/part-sm.png"></a> <% } %> - <a data-type="beam" class="btn btn-primary btn-ribbon ribbonCellMode<% if (cellMode == "beam"){ %> ribbon-selected<% } %>" href="#">Beam</a> + <!--<a data-type="beam" class="btn btn-primary btn-ribbon ribbonCellMode<% if (cellMode == "beam"){ %> ribbon-selected<% } %>" href="#">Beam</a>--> <a class="btn btn-primary btn-ribbon ribbonDeleteMode<% if (deleteMode){ %> ribbon-selected"<% } %>"><span class="fui-cross"></span></a> </div> </div> -- GitLab