From 8f342b69261db4ba4ee399394eaab678cbed262e Mon Sep 17 00:00:00 2001
From: Amanda Ghassaei <amandaghassaei@gmail.com>
Date: Sun, 9 Aug 2015 23:07:07 -0400
Subject: [PATCH] viewing options

---
 js/lattice/LatticeEsim.js               |  6 +++---
 js/menus/templates/ESetupMenuView.html  |  6 +++++-
 js/menus/templates/EStaticMenuView.html | 12 +++++++++---
 js/simulation/electronics/eSim.js       |  4 +++-
 4 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/js/lattice/LatticeEsim.js b/js/lattice/LatticeEsim.js
index dcabf95b..a120eab0 100644
--- a/js/lattice/LatticeEsim.js
+++ b/js/lattice/LatticeEsim.js
@@ -15,13 +15,13 @@ define(['lattice', 'appState', 'threeModel', 'eSim', 'eSimCell', 'eSimSuperCell'
         },
 
         _showConductors: function(){
-            if (!eSim.get("conductorGroups") || eSim.get("conductorGroups").length == 0){
+            var groupNum = eSim.get("visibleConductorGroup");
+            if (!eSim.get("conductorGroups") || eSim.get("conductorGroups").length == 0 || groupNum == -2){
                 this.setOpaque();
                 three.render();
                 return;
             }
-            var groupNum = eSim.get("visibleConductorGroup");
-            var allVisible = groupNum < 0;
+            var allVisible = groupNum == -1;
             this._loopCells(this.sparseCells, function(cell){
                 if (cell) cell.setTransparent(function(evalCell){
                     return !(evalCell.conductiveGroupVisible(allVisible, groupNum));
diff --git a/js/menus/templates/ESetupMenuView.html b/js/menus/templates/ESetupMenuView.html
index a897a638..4fed4531 100644
--- a/js/menus/templates/ESetupMenuView.html
+++ b/js/menus/templates/ESetupMenuView.html
@@ -15,7 +15,11 @@ Simulation Type: &nbsp;&nbsp;
     Num Connected Conductors: &nbsp;&nbsp<%= conductorGroups.length %><br/>
     <% if(conductorGroups.length > 0){ %>
         <label class="radio">
-            <input type="radio" <% if (visibleConductorGroup < 0){ %>checked<% } %> name="visibleConductorGroup" value="-1" data-toggle="radio" class="custom-radio eSim"><span class="icons"><span class="icon-unchecked"></span><span class="icon-checked"></span></span>
+            <input type="radio" <% if (visibleConductorGroup == -2){ %>checked<% } %> name="visibleConductorGroup" value="-2" data-toggle="radio" class="custom-radio eSim"><span class="icons"><span class="icon-unchecked"></span><span class="icon-checked"></span></span>
+            Show Everything
+        </label>
+        <label class="radio">
+            <input type="radio" <% if (visibleConductorGroup == -1){ %>checked<% } %> name="visibleConductorGroup" value="-1" data-toggle="radio" class="custom-radio eSim"><span class="icons"><span class="icon-unchecked"></span><span class="icon-checked"></span></span>
             Show All Conducting Groups
         </label>
         <% _.each(conductorGroups, function(groupData, index){ %>
diff --git a/js/menus/templates/EStaticMenuView.html b/js/menus/templates/EStaticMenuView.html
index 1e2c04a1..86bd6115 100644
--- a/js/menus/templates/EStaticMenuView.html
+++ b/js/menus/templates/EStaticMenuView.html
@@ -1,6 +1,10 @@
 <% if(conductorGroups && conductorGroups.length > 0){ %>
     <label class="radio">
-        <input type="radio" <% if (visibleConductorGroup < 0){ %>checked<% } %> name="visibleConductorGroup" value="-1" data-toggle="radio" class="custom-radio eSim"><span class="icons"><span class="icon-unchecked"></span><span class="icon-checked"></span></span>
+        <input type="radio" <% if (visibleConductorGroup == -2){ %>checked<% } %> name="visibleConductorGroup" value="-2" data-toggle="radio" class="custom-radio eSim"><span class="icons"><span class="icon-unchecked"></span><span class="icon-checked"></span></span>
+        Show Everything
+    </label>
+    <label class="radio">
+        <input type="radio" <% if (visibleConductorGroup == -1){ %>checked<% } %> name="visibleConductorGroup" value="-1" data-toggle="radio" class="custom-radio eSim"><span class="icons"><span class="icon-unchecked"></span><span class="icon-checked"></span></span>
         Show All Conducting Groups
     </label>
     <% _.each(conductorGroups, function(groupData, index){ %>
@@ -11,8 +15,10 @@
             <input data-property="current" data-index="<%= index %>" value="<%= groupData.current %>" placeholder="Current" class="form-control floatInput eSimGroup currentInput" type="text">
         </label>
     <% }); %><br/>
-    <div class="inlineSwatch capacitance"></div>Capacitance:<br/><br/>
-    <div class="inlineSwatch inductance"></div>Inductance:<br/>
+    <div class="inlineSwatch capacitance"></div>Capacitance:<br/>
+    <div class="inlineSwatch inductance"></div>Inductance:<br/><br/>
+    <a href="#" id="calcCapacitance" class="btn btn-block btn-lg btn-default"><% if(globalCapacitance){ %>Re-<% } %>Calculate Capacitance</a><br/>
+    <a href="#" id="calcInductance" class="btn btn-block btn-lg btn-default"><% if(globalInductance){ %>Re-<% } %>Calculate Inductance</a><br/>
 <% } else { %>
     <div class="inlineWarning">No conductive groups detected, please navigate to previous tab and calculate.</div>
 <% } %>
\ No newline at end of file
diff --git a/js/simulation/electronics/eSim.js b/js/simulation/electronics/eSim.js
index e4f64174..8f1d140f 100644
--- a/js/simulation/electronics/eSim.js
+++ b/js/simulation/electronics/eSim.js
@@ -9,7 +9,9 @@ define(['underscore', 'backbone'], function(_, Backbone){
 
         defaults:{
             conductorGroups: null,//[{id: xx, current:xx, voltage:xx}]
-            visibleConductorGroup: -1
+            visibleConductorGroup: -1,
+            globalCapacitance: null,
+            globalInductance: null
         }
 
 
-- 
GitLab