Просмотр исходного кода

fix(remotecontrol): Disable the keyboard shortcuts during remote control

master
hristoterezov 8 лет назад
Родитель
Сommit
5d269ad0aa
2 измененных файлов: 22 добавлений и 0 удалений
  1. 20
    0
      modules/keyboardshortcut/keyboardshortcut.js
  2. 2
    0
      modules/remotecontrol/Controller.js

+ 20
- 0
modules/keyboardshortcut/keyboardshortcut.js Просмотреть файл

65
  */
65
  */
66
 let _shortcuts = {};
66
 let _shortcuts = {};
67
 
67
 
68
+/**
69
+ * True if the keyboard shortcuts are enabled and false if not.
70
+ * @type {boolean}
71
+ */
72
+let enabled = true;
73
+
68
 /**
74
 /**
69
  * Maps keycode to character, id of popover for given function and function.
75
  * Maps keycode to character, id of popover for given function and function.
70
  */
76
  */
74
 
80
 
75
         var self = this;
81
         var self = this;
76
         window.onkeyup = function(e) {
82
         window.onkeyup = function(e) {
83
+            if(!enabled) {
84
+                return;
85
+            }
77
             var key = self._getKeyboardKey(e).toUpperCase();
86
             var key = self._getKeyboardKey(e).toUpperCase();
78
             var num = parseInt(key, 10);
87
             var num = parseInt(key, 10);
79
             if(!($(":focus").is("input[type=text]") ||
88
             if(!($(":focus").is("input[type=text]") ||
93
         };
102
         };
94
 
103
 
95
         window.onkeydown = function(e) {
104
         window.onkeydown = function(e) {
105
+            if(!enabled) {
106
+                return;
107
+            }
96
             if(!($(":focus").is("input[type=text]") ||
108
             if(!($(":focus").is("input[type=text]") ||
97
                 $(":focus").is("input[type=password]") ||
109
                 $(":focus").is("input[type=password]") ||
98
                 $(":focus").is("textarea"))) {
110
                 $(":focus").is("textarea"))) {
105
         };
117
         };
106
     },
118
     },
107
 
119
 
120
+    /**
121
+     * Enables/Disables the keyboard shortcuts.
122
+     * @param {boolean} value - the new value.
123
+     */
124
+    enable: function (value) {
125
+        enabled = value;
126
+    },
127
+
108
     /**
128
     /**
109
      * Registers a new shortcut.
129
      * Registers a new shortcut.
110
      *
130
      *

+ 2
- 0
modules/remotecontrol/Controller.js Просмотреть файл

167
     _start() {
167
     _start() {
168
         if(!this.enabled)
168
         if(!this.enabled)
169
             return;
169
             return;
170
+        APP.keyboardshortcut.enable(false);
170
         APP.conference.addConferenceListener(
171
         APP.conference.addConferenceListener(
171
             ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
172
             ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
172
             this._stopListener);
173
             this._stopListener);
207
         if(!this.controlledParticipant) {
208
         if(!this.controlledParticipant) {
208
             return;
209
             return;
209
         }
210
         }
211
+        APP.keyboardshortcut.enable(true);
210
         APP.conference.removeConferenceListener(
212
         APP.conference.removeConferenceListener(
211
             ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
213
             ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
212
             this._stopListener);
214
             this._stopListener);

Загрузка…
Отмена
Сохранить