浏览代码

Merge pull request #705 from bgrozev/esc-shortcut

Hide the shortcuts panel when the Escape key is pressed.
j8
Дамян Минков 9 年前
父节点
当前提交
f3dc6f15e4
共有 2 个文件被更改,包括 25 次插入8 次删除
  1. 12
    1
      modules/UI/UI.js
  2. 13
    7
      modules/keyboardshortcut/keyboardshortcut.js

+ 12
- 1
modules/UI/UI.js 查看文件

@@ -1416,10 +1416,21 @@ UI.hideRingOverLay = function () {
1416 1416
 };
1417 1417
 
1418 1418
 /**
1419
- * Shows or hides the keyboard shortcuts panel.'
1419
+ * Shows or hides the keyboard shortcuts panel, depending on the current state.'
1420 1420
  */
1421 1421
 UI.toggleKeyboardShortcutsPanel = function() {
1422 1422
     $('#keyboard-shortcuts').toggle();
1423 1423
 };
1424 1424
 
1425
+/**
1426
+ * Shows or hides the keyboard shortcuts panel.'
1427
+ */
1428
+UI.showKeyboardShortcutsPanel = function(show) {
1429
+    if (show) {
1430
+        $('#keyboard-shortcuts').show();
1431
+    } else {
1432
+        $('#keyboard-shortcuts').hide();
1433
+    }
1434
+};
1435
+
1425 1436
 module.exports = UI;

+ 13
- 7
modules/keyboardshortcut/keyboardshortcut.js 查看文件

@@ -3,13 +3,10 @@
3 3
 var shortcuts = {};
4 4
 function initShortcutHandlers() {
5 5
     shortcuts = {
6
-        191: {
7
-            character: "/",
8
-            function: function(e) {
9
-                // Only trigger on "?", not on "/".
10
-                if (e.shiftKey) {
11
-                    APP.UI.toggleKeyboardShortcutsPanel();
12
-                }
6
+        27: {
7
+            character: "Esc",
8
+            function: function() {
9
+                APP.UI.showKeyboardShortcutsPanel(false);
13 10
             }
14 11
         },
15 12
         67: {
@@ -59,6 +56,15 @@ function initShortcutHandlers() {
59 56
             function: function() {
60 57
                 APP.conference.toggleVideoMuted();
61 58
             }
59
+        },
60
+        191: {
61
+            character: "/",
62
+            function: function(e) {
63
+                // Only trigger on "?", not on "/".
64
+                if (e.shiftKey) {
65
+                    APP.UI.toggleKeyboardShortcutsPanel();
66
+                }
67
+            }
62 68
         }
63 69
     };
64 70
 }

正在加载...
取消
保存