diff --git a/js/cells/DMACell.js b/js/cells/DMACell.js index 3121ecdf5a2cb472c87d3227bded3619107d49ba..53e652f97c2757d5d67053471245c5d50d0a0c62 100644 --- a/js/cells/DMACell.js +++ b/js/cells/DMACell.js @@ -247,7 +247,6 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals', ' 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; }; @@ -257,6 +256,11 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals', ' this.isTransparent = transparent; this.setMaterial(this.getMaterial(true)); this.setWireframeVisibility(!this.isTransparent); + if (this.parts) { + _.each(this.parts, function(part){ + part.updateMaterial(); + }); + } }; DMACell.prototype.getConditionalMode = function(mode){ diff --git a/js/materials/DMAMaterials.js b/js/materials/DMAMaterials.js index f075689b3937b15feddf915e140ecaaf1c29d94e..1cfa0213428fe72cb83dcc7a3ce3aa8e9d7cf62d 100644 --- a/js/materials/DMAMaterials.js +++ b/js/materials/DMAMaterials.js @@ -198,6 +198,7 @@ define(['underscore', 'three', 'appState', 'lattice', 'plist', 'threeModel'], fu } function makeMaterialObject(color, transparent){ +// return new THREE.MeshNormalMaterial({shading:THREE.FlatShading}); if (transparent) return new THREE.MeshLambertMaterial({color:color, shading:THREE.FlatShading, transparent: true, opacity:0.1}); return new THREE.MeshLambertMaterial({color:color, shading:THREE.FlatShading}); } diff --git a/js/menus/MSetupMenuView.js b/js/menus/MSetupMenuView.js index c8d1c70ddccfecdef58f160f9bdf58b218f06f7f..3a0f9aaea1864200ed81c7ece7d446443bf7d697 100644 --- a/js/menus/MSetupMenuView.js +++ b/js/menus/MSetupMenuView.js @@ -11,10 +11,16 @@ define(['jquery', 'underscore', 'menuParent', 'plist', 'text!mSetupMenuTemplate' }, _initialize: function(){ + this.listenTo(this.model, "change:materialClass", this._changeSimNav); + }, + + _changeSimNav: function(){ + var materialClass = this.model.get("materialClass"); + this.model.set("currentNav", materialClass + "NavSim"); }, _makeTemplateJSON: function(){ - return null; + return _.extend(this.model.toJSON(), plist); }, template: _.template(template) diff --git a/js/menus/templates/ESetupMenuView.html b/js/menus/templates/ESetupMenuView.html index e5ae5f517a283bd0538eb255faaf6418026305ad..4b9e81196993f41a6f3f0b1f027c45803b2d6653 100644 --- a/js/menus/templates/ESetupMenuView.html +++ b/js/menus/templates/ESetupMenuView.html @@ -7,7 +7,7 @@ Simulation Type: <% }); %> </ul> </div><br/><br/> -<a href="#" id="calcConnectivity" class="btn btn-block btn-lg btn-default">Calculate Connectivity</a><br/> +<a href="#" id="calcConnectivity" class="btn btn-block btn-lg btn-default"><% if(conductorGroups){ %>Re-<% } %>Calculate Connectivity</a><br/> <% if(conductorGroups){ %> Num Connected Conductors:  <%= conductorGroups.length %><br/> <label class="radio"> diff --git a/js/menus/templates/MSetupMenuView.html b/js/menus/templates/MSetupMenuView.html index 1edc0e9df5424a015b1d1843c5a16d04cc86abd9..3508aa11ddf37dbaf0c49b771f69a7177820ab9f 100644 --- a/js/menus/templates/MSetupMenuView.html +++ b/js/menus/templates/MSetupMenuView.html @@ -1 +1,10 @@ +Simulation Type: + <div class="btn-group"> + <button data-toggle="dropdown" class="btn dropdown-toggle" type="button"><%= allMaterialClasses[materialClass] %><span class="caret"></span></button> + <ul role="menu" class="dropdown-menu"> + <% _.each(_.keys(allMaterialClasses), function(key){ %> + <li><a class="appState dropdownSelector" data-property="materialClass" data-value="<%= key %>" href="#"><%= allMaterialClasses[key] %></a></li> + <% }); %> + </ul> + </div><br/><br/> setup, boundary conditions, physics \ No newline at end of file diff --git a/js/parts/DMAPart.js b/js/parts/DMAPart.js index 73d1b4aca2e8f5dcfb1671bea3f581e5a7674983..de0a14a553445b65a0c67686d30ea31c50623fb8 100644 --- a/js/parts/DMAPart.js +++ b/js/parts/DMAPart.js @@ -28,6 +28,7 @@ define(['underscore', 'three'], function(_, THREE){ }; DMAPart.prototype.getMaterial = function(returnTHREEObject){ +// return new THREE.MeshLambertMaterial({color:'#aaaaaa', shading:THREE.FlatShading}); return this.parentCell.getMaterial(returnTHREEObject); }; @@ -35,6 +36,10 @@ define(['underscore', 'three'], function(_, THREE){ this.mesh.material = material; }; + DMAPart.prototype.updateMaterial = function(){ + this.mesh.material = this.getMaterial(true); + }; + DMAPart.prototype.destroy = function(){ if (this.mesh) { this.parentCell.removeChildren(this.mesh);