diff --git a/js/lattice/LatticeEsim.js b/js/lattice/LatticeEsim.js index 80061c6ef8ce337f52cc6b732df655a749562587..ac8f21ff2336828064d3fa7dbf37d4efc4f323c9 100644 --- a/js/lattice/LatticeEsim.js +++ b/js/lattice/LatticeEsim.js @@ -46,7 +46,9 @@ define(['lattice', 'appState', 'threeModel', 'eSim', 'eSimCell', 'eSimSuperCell' var groups = []; this._loopCells(this.cells, function(cell){ if (!cell) return; - if (groups.indexOf(cell.getConductorGroupNum()) < 0 && cell.isConductive()) groups.push(cell.getConductorGroupNum()); + if (groups.indexOf(cell.getConductorGroupNum()) < 0 && cell.isConductive()) { + groups.push({id:cell.getConductorGroupNum(), current: null, voltage: null}); + } }); eSim.set("conductorGroups", groups); }, diff --git a/js/menus/EStaticMenuView.js b/js/menus/EStaticMenuView.js index 6257fdef21bab8eb639066c39d30ccc85b5250f4..328d3616878fc710418f5dd34fab3b08f36d5bb0 100644 --- a/js/menus/EStaticMenuView.js +++ b/js/menus/EStaticMenuView.js @@ -3,7 +3,8 @@ */ -define(['jquery', 'underscore', 'menuParent', 'plist', 'text!eStaticMenuTemplate'], function($, _, MenuParentView, plist, template){ +define(['jquery', 'underscore', 'menuParent', 'plist', 'text!eStaticMenuTemplate', 'eSim'], + function($, _, MenuParentView, plist, template, eSim){ return MenuParentView.extend({ @@ -11,12 +12,19 @@ define(['jquery', 'underscore', 'menuParent', 'plist', 'text!eStaticMenuTemplate }, _initialize: function(){ + this.listenTo(eSim, "change", this.render); }, - _makeTemplateJSON: function(){ + getPropertyOwner: function($target){ + if ($target.hasClass("eSim")) return eSim; return null; }, + _makeTemplateJSON: function(){ + console.log(eSim.get("conductorGroups")); + return _.extend(this.model.toJSON(), eSim.toJSON()); + }, + template: _.template(template) }); }); \ No newline at end of file diff --git a/js/menus/templates/ESetupMenuView.html b/js/menus/templates/ESetupMenuView.html index 741707ab7fd73efb3160bca3771088bd01b23b99..155d7837062c3d8355c2d001433e0f54906fb73e 100644 --- a/js/menus/templates/ESetupMenuView.html +++ b/js/menus/templates/ESetupMenuView.html @@ -18,10 +18,10 @@ Simulation Type: <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> Show All Conducting Groups </label> - <% _.each(conductorGroups, function(groupNum, index){ %> + <% _.each(conductorGroups, function(groupData, index){ %> <label class="radio"> - <input type="radio" <% if (groupNum == visibleConductorGroup){ %>checked<% } %> name="visibleConductorGroup" value="<%= groupNum %>" data-toggle="radio" class="custom-radio eSim"><span class="icons"><span class="icon-unchecked"></span><span class="icon-checked"></span></span> - Group Num <%= index + 1 %> + <input type="radio" <% if (groupData.id == visibleConductorGroup){ %>checked<% } %> name="visibleConductorGroup" value="<%= groupData.id %>" data-toggle="radio" class="custom-radio eSim"><span class="icons"><span class="icon-unchecked"></span><span class="icon-checked"></span></span> + Group <%= index + 1 %> </label> <% }); %> <% } %> diff --git a/js/menus/templates/EStaticMenuView.html b/js/menus/templates/EStaticMenuView.html index 3db74993137d281382650bfdd7e50aaa1cae1f78..08524b07595c4cc93fc586844e09a8a50f988e5c 100644 --- a/js/menus/templates/EStaticMenuView.html +++ b/js/menus/templates/EStaticMenuView.html @@ -1,3 +1,18 @@ -static calculations:<br/> -capacitance<br/> +<% 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> + Show All Conducting Groups + </label> + <% _.each(conductorGroups, function(groupData, index){ %> + <label class="radio"> + <input type="radio" <% if (groupData.id == visibleConductorGroup){ %>checked<% } %> name="visibleConductorGroup" value="<%= groupData.id %>" data-toggle="radio" class="custom-radio eSim"><span class="icons"><span class="icon-unchecked"></span><span class="icon-checked"></span></span> + Group <%= index + 1 %> + <input data-property="voltage" value="<%= groupData.voltage %>" placeholder="Voltage" class="form-control floatInput eSim" type="text"> + <input data-property="current" value="<%= groupData.current %>" placeholder="Current" class="form-control floatInput eSim" type="text"> + </label> + <% }); %> +<% } %> + +Capacitance:<br/> + inductance<br/> \ No newline at end of file diff --git a/js/simulation/electronics/eSim.js b/js/simulation/electronics/eSim.js index 60f59d8686355eafcc71b2dbbad6a026f9b69154..e4f64174524ea48ce992892c0340a0bee5346092 100644 --- a/js/simulation/electronics/eSim.js +++ b/js/simulation/electronics/eSim.js @@ -8,7 +8,7 @@ define(['underscore', 'backbone'], function(_, Backbone){ var eSim = Backbone.Model.extend({ defaults:{ - conductorGroups: null, + conductorGroups: null,//[{id: xx, current:xx, voltage:xx}] visibleConductorGroup: -1 }