From 6b2c3ac8c2018ce0bc5bf2657af120c37ac33f0b Mon Sep 17 00:00:00 2001 From: amandaghassaei <amandaghassaei@gmail.com> Date: Wed, 18 Mar 2015 19:59:02 -0400 Subject: [PATCH] event bindings --- js/menus/AssemblerMenuView.js | 7 +++++++ js/menus/LatticeMenuView.js | 8 ++++++++ js/menus/PartMenuView.js | 10 +++++++++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/js/menus/AssemblerMenuView.js b/js/menus/AssemblerMenuView.js index 139247b3..bdde47f7 100644 --- a/js/menus/AssemblerMenuView.js +++ b/js/menus/AssemblerMenuView.js @@ -23,6 +23,13 @@ AssemblerMenuView = Backbone.View.extend({ _onKeyup: function(e){ if (this.model.get("currentTab") != "assembler") return; + + if ($("input").is(":focus") && e.keyCode == 13) {//enter key + $(e.target).blur(); + this.render(); + return; + } + if ($(".placementOrder").is(":focus")) this._updatePlacementOrder(e); }, diff --git a/js/menus/LatticeMenuView.js b/js/menus/LatticeMenuView.js index 5a067353..f28c0e18 100644 --- a/js/menus/LatticeMenuView.js +++ b/js/menus/LatticeMenuView.js @@ -31,6 +31,14 @@ LatticeMenuView = Backbone.View.extend({ }, _onKeyup: function(e){ + if (this.model.get("currentTab") != "lattice") return; + + if ($("input").is(":focus") && e.keyCode == 13) {//enter key + $(e.target).blur(); + this.render(); + return; + } + if ($(".cellSeparation").is(":focus")) this._updateNumber(e, "cellSeparation"); }, diff --git a/js/menus/PartMenuView.js b/js/menus/PartMenuView.js index be196944..0153d0f8 100644 --- a/js/menus/PartMenuView.js +++ b/js/menus/PartMenuView.js @@ -7,7 +7,7 @@ PartMenuView = Backbone.View.extend({ el: "#menuContent", events: { - "click .partType": "_changePartType" + "click .partType": "_changePartType", }, initialize: function(options){ @@ -23,6 +23,14 @@ PartMenuView = Backbone.View.extend({ }, _onKeyup: function(e){ + if (this.model.get("currentTab") != "part") return; + + if ($("input").is(":focus") && e.keyCode == 13) {//enter key + $(e.target).blur(); + this.render(); + return; + } + if ($(".cellSeparation").is(":focus")) this._updateNumber(e, "cellSeparation"); }, -- GitLab