diff --git a/js/menus/CamMenuView.js b/js/menus/CamMenuView.js index a115d9939c9ec28ef79cc4ca7300a854860c5d43..9597af63097d1569642015470fbe91b784ad13a8 100644 --- a/js/menus/CamMenuView.js +++ b/js/menus/CamMenuView.js @@ -90,7 +90,8 @@ CamMenuView = Backbone.View.extend({ Stock (xyz): <input data-type="x" value="<%= stockPosition.x %>" placeholder="X" class="form-control numberInput stockPosition" type="text">\ <input data-type="y" value="<%= stockPosition.y %>" placeholder="Y" class="form-control numberInput stockPosition" type="text">\ <input data-type="z" value="<%= stockPosition.z %>" placeholder="Z" class="form-control numberInput stockPosition" type="text"><br/><br/>\ - Rapid Speeds (xy, z): <input data-type="xy" value="<%= rapidSpeeds.xy %>" placeholder="XY" class="form-control numberInput rapidSpeeds" type="text">\ + Speeds (measured in <%= units %> per second):<br/><br/>\ + Rapids (xy, z): <input data-type="xy" value="<%= rapidSpeeds.xy %>" placeholder="XY" class="form-control numberInput rapidSpeeds" type="text">\ <input data-type="z" value="<%= rapidSpeeds.z %>" placeholder="Z" class="form-control numberInput rapidSpeeds" type="text"><br/><br/>\ Feed Rate (xy, z): <input data-type="xy" value="<%= feedRate.xy %>" placeholder="XY" class="form-control numberInput feedRate" type="text">\ <input data-type="z" value="<%= feedRate.z %>" placeholder="Z" class="form-control numberInput feedRate" type="text">\ diff --git a/js/menus/LatticeMenuView.js b/js/menus/LatticeMenuView.js index 9c5bf3756cc0f44075f49e6be5514f4c0c2f6438..885d2673092d8911de51013a6920e1254d08aa9d 100644 --- a/js/menus/LatticeMenuView.js +++ b/js/menus/LatticeMenuView.js @@ -25,9 +25,23 @@ LatticeMenuView = Backbone.View.extend({ this.lattice = options.lattice; _.bindAll(this, "render"); - + _.bindAll(this, "_onKeyup"); //bind events this.listenTo(this.lattice, "change", this.render); + $(document).bind('keyup', {state:false}, this._onKeyup); + }, + + _onKeyup: function(e){ + if ($(".cellSeparation").is(":focus")) this._updateNumber(e, "cellSeparation"); + }, + + _updateNumber: function(e, property){ + e.preventDefault(); + var newVal = parseFloat($(e.target).val()); + if (isNaN(newVal)) return; + var object = this.lattice.get(property); + object[$(e.target).data("type")] = newVal; + this.lattice.trigger("change:"+property); }, _clearCells: function(e){ @@ -151,7 +165,11 @@ LatticeMenuView = Backbone.View.extend({ <% }); %>\ </ul>\ </div><br/><br/>\ - Num Cells: <%= numCells %><br/>\ + Cell Separation <% if (connectionType != "freeformFace"){ %>(xy, z): <input data-type="xy" value="<%= cellSeparation.xy %>" placeholder="XY" class="form-control numberInput cellSeparation" type="text">\ + <input data-type="z" value="<%= cellSeparation.z %>" placeholder="Z" class="form-control numberInput cellSeparation" type="text">\ + <% } else { %>( radial ): <input data-type="xy" value="<%= cellSeparation.xy %>" placeholder="XY" class="form-control numberInput cellSeparation" type="text"><% } %>\ + <br/><br/>\ + Num Cells: <%= numCells %><br/><br/>\ <br/>\ <a href="#" id="latticeMenuClearCells" class=" btn btn-block btn-lg btn-default">Clear All Cells</a><br/>\ hint: click to create cells, shift+drag to create a lot of cells, d+click to delete cells<br/>\