diff --git a/js/lattice/LatticeBase.js b/js/lattice/LatticeBase.js index e045e8ba0dd32ec2754c6ec7fe1d706f48785a66..bc7993afd6ff8dcc6a050138a453244995c9dec9 100644 --- a/js/lattice/LatticeBase.js +++ b/js/lattice/LatticeBase.js @@ -432,6 +432,18 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre _updateForMode: function(){ var cellMode = appState.get("cellMode"); var numCells = this.get("numCells"); + if (cellMode == "hide"){ + this._iterCells(this.sparseCells, function(cell){ + if (cell) cell.hide(); + }); + three.render(); + return; + } + if (appState.previous("cellMode") == "hide"){ + this._iterCells(this.sparseCells, function(cell){ + if (cell) cell.show(); + }); + } this._iterCells(this.sparseCells, function(cell){ if (cell) cell.setMode(cellMode, function(){ if (--numCells <= 0) three.render(); diff --git a/js/menus/templates/EStaticMenuView.html b/js/menus/templates/EStaticMenuView.html index 89a5a17b9d2fe5ee5a68d6523e5c9fbc03fb074b..382afceae60135bc963d8cc931e5adb6ac0a5165 100644 --- a/js/menus/templates/EStaticMenuView.html +++ b/js/menus/templates/EStaticMenuView.html @@ -48,7 +48,7 @@ </label> <% }); %> <% if(visibleStaticSim != "none"){ %> - Simulation Z Height: <input data-property="simZHeight" value="<%= simZHeight %>" placeholder="Height" class="form-control intInput eSim" type="text"><br/><br/> + Simulation Z Height (up/down arrows): <input data-property="simZHeight" value="<%= simZHeight %>" placeholder="Height" class="form-control intInput eSim" type="text"><br/><br/> <% } %> <% } else { %> <div class="inlineWarning">No conductive groups detected, please navigate to previous tab and calculate.</div> diff --git a/js/menus/templates/Ribbon.html b/js/menus/templates/Ribbon.html index 179021b33a7af38d87f0edc518550f424fde42d6..64cc19de1d79c6eff79384f55236297d8ac48546 100644 --- a/js/menus/templates/Ribbon.html +++ b/js/menus/templates/Ribbon.html @@ -6,6 +6,7 @@ <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="hide" class="btn btn-primary btn-ribbon ribbonCellMode<% if (cellMode == "hide"){ %> ribbon-selected"<% } %>">Hide</a> <a class="btn btn-primary btn-ribbon ribbonDeleteMode<% if (deleteMode){ %> ribbon-selected"<% } %>"><span class="fui-cross"></span></a> </div> </div> diff --git a/js/models/AppState.js b/js/models/AppState.js index a1271a8e2c3d843f89bfe7a310d27226f991fd9b..ef40440390db19ea603ecc5b121bd1535cbcd905 100644 --- a/js/models/AppState.js +++ b/js/models/AppState.js @@ -61,7 +61,8 @@ define(['underscore', 'backbone', 'threeModel', 'three', 'plist', 'globals'], fu this.listenTo(this, "change:materialType", this._materialTypeChanged); this.listenTo(this, "change:gikLength", this._gikLengthChanged); - this.downKeys = {};//track keypresses to prevent repeat keystrokeson hold + this.downKeys = {};//track keypresses to prevent repeat keystrokes on hold + this.lastCellMode = this.get("cellMode");//store this to toggle on/off hide mode if (this.isMobile()) this.set("menuIsVisible", false); }, @@ -170,6 +171,13 @@ define(['underscore', 'backbone', 'threeModel', 'three', 'plist', 'globals'], fu case 68://d delete mode this.set("deleteMode", state); break; + case 72://h hide mode + if (state) { + this.lastCellMode = this.get("cellMode"); + this.set("cellMode", "hide"); + } + else this.set("cellMode", this.lastCellMode); + break; case 69://e // if (currentTab != "sketch") return; this.set("extrudeMode", state); diff --git a/js/simulation/electronics/eSimField.js b/js/simulation/electronics/eSimField.js index 802f3a5a5473e8313a977f7e02d484a5641c9809..5056568d8daf17dcdf0489375bea53936bdbb39e 100644 --- a/js/simulation/electronics/eSimField.js +++ b/js/simulation/electronics/eSimField.js @@ -5,7 +5,7 @@ //hold and display data for various fields -define(['underscore', 'threeModel'], function(_, three){ +define(['underscore', 'threeModel', 'lattice'], function(_, three, lattice){ function ESimField(data, offset, resolution, height, dataRange){ @@ -36,7 +36,7 @@ define(['underscore', 'threeModel'], function(_, three){ }; ESimField.prototype._setObject3DPosition = function(offset, resolution, height){ - this._object3D.position.set(offset.x, offset.y, offset.z+height/resolution); + this._object3D.position.set(offset.x, offset.y, offset.z+height*lattice.zScale()/resolution); }; ESimField.prototype._createThreeObjects = function(data, offset, size, height, object3D){