Ver código fonte

Hide the shortcuts panel when the Escape key is pressed.

master
Boris Grozev 9 anos atrás
pai
commit
2cefea3677
2 arquivos alterados com 25 adições e 8 exclusões
  1. 12
    1
      modules/UI/UI.js
  2. 13
    7
      modules/keyboardshortcut/keyboardshortcut.js

+ 12
- 1
modules/UI/UI.js Ver arquivo

1398
 };
1398
 };
1399
 
1399
 
1400
 /**
1400
 /**
1401
- * Shows or hides the keyboard shortcuts panel.'
1401
+ * Shows or hides the keyboard shortcuts panel, depending on the current state.'
1402
  */
1402
  */
1403
 UI.toggleKeyboardShortcutsPanel = function() {
1403
 UI.toggleKeyboardShortcutsPanel = function() {
1404
     $('#keyboard-shortcuts').toggle();
1404
     $('#keyboard-shortcuts').toggle();
1405
 };
1405
 };
1406
 
1406
 
1407
+/**
1408
+ * Shows or hides the keyboard shortcuts panel.'
1409
+ */
1410
+UI.showKeyboardShortcutsPanel = function(show) {
1411
+    if (show) {
1412
+        $('#keyboard-shortcuts').show();
1413
+    } else {
1414
+        $('#keyboard-shortcuts').hide();
1415
+    }
1416
+};
1417
+
1407
 module.exports = UI;
1418
 module.exports = UI;

+ 13
- 7
modules/keyboardshortcut/keyboardshortcut.js Ver arquivo

3
 var shortcuts = {};
3
 var shortcuts = {};
4
 function initShortcutHandlers() {
4
 function initShortcutHandlers() {
5
     shortcuts = {
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
         67: {
12
         67: {
52
             function: function() {
49
             function: function() {
53
                 APP.conference.toggleVideoMuted();
50
                 APP.conference.toggleVideoMuted();
54
             }
51
             }
52
+        },
53
+        191: {
54
+            character: "/",
55
+            function: function(e) {
56
+                // Only trigger on "?", not on "/".
57
+                if (e.shiftKey) {
58
+                    APP.UI.toggleKeyboardShortcutsPanel();
59
+                }
60
+            }
55
         }
61
         }
56
     };
62
     };
57
 }
63
 }

Carregando…
Cancelar
Salvar